From 8f045806f3dbbc5ecf0a28446ee3ba8f3c5c8ead Mon Sep 17 00:00:00 2001 From: Abel Santos Date: Tue, 7 Sep 2021 11:24:52 +0200 Subject: [PATCH] OEL-450: Add test SiteBrandingBlockTest. --- .phpunit.result.cache | 1 - config/install/oe_whitelabel.settings.yml | 17 ----- config/schema/oe_whitelabel.schema.yml | 5 -- tests/Functional/SiteBrandingBlockTest.php | 78 ++++++++++++++++++++++ 4 files changed, 78 insertions(+), 23 deletions(-) delete mode 100644 .phpunit.result.cache delete mode 100644 config/install/oe_whitelabel.settings.yml delete mode 100644 config/schema/oe_whitelabel.schema.yml create mode 100644 tests/Functional/SiteBrandingBlockTest.php diff --git a/.phpunit.result.cache b/.phpunit.result.cache deleted file mode 100644 index 2de2a6daf..000000000 --- a/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"defects":[],"times":[]} \ No newline at end of file diff --git a/config/install/oe_whitelabel.settings.yml b/config/install/oe_whitelabel.settings.yml deleted file mode 100644 index c2375f029..000000000 --- a/config/install/oe_whitelabel.settings.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Default settings should not be located here. This file is only used to -# initially install a theme's "settings". -# -# Instead, the Drupal Bootstrap base theme uses the @BootstrapSetting -# annotated plugin discovery process. This ensures that sub-theme settings are -# inherited from base themes themes properly and to determine when a setting -# should be saved to config as "overridden". -# -# @see \Drupal\bootstrap\Plugin\SettingBase -# @see \Drupal\bootstrap\Plugin\SettingInterface -# @see \Drupal\bootstrap\Plugin\SettingManager -# @see \Drupal\bootstrap\Plugin\Form\SystemThemeSettings -# @see \Drupal\bootstrap\ThemeSettings - -# This file cannot be empty, so install an initial empty array for "schemas". -# @see https://www.drupal.org/node/2813829 -schemas: [] diff --git a/config/schema/oe_whitelabel.schema.yml b/config/schema/oe_whitelabel.schema.yml deleted file mode 100644 index a92883f88..000000000 --- a/config/schema/oe_whitelabel.schema.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Schema for the configuration files of the OpenEuropa Whitelabel theme. - -oe_whitelabel.settings: - type: theme_settings - label: 'OpenEuropa Whitelabel settings' diff --git a/tests/Functional/SiteBrandingBlockTest.php b/tests/Functional/SiteBrandingBlockTest.php new file mode 100644 index 000000000..3627aae23 --- /dev/null +++ b/tests/Functional/SiteBrandingBlockTest.php @@ -0,0 +1,78 @@ +install(['oe_whitelabel']); + \Drupal::configFactory() + ->getEditable('system.theme') + ->set('default', 'oe_whitelabel') + ->save(); + + /* Rebuild the ui_pattern definitions to collect the ones provided by + oe_whitelabel itself. */ + \Drupal::service('plugin.manager.ui_patterns')->clearCachedDefinitions(); + + // Ensure that the system breadcrumb is placed as well. + $this->drupalPlaceBlock('osystem_branding_block', [ + 'region' => 'header', + ]); + + } + + /** + * Asserts classes contained at site branding block. + */ + public function testClassesSiteName(): void { + ini_set('xdebug.var_display_max_depth', '10'); + ini_set('xdebug.var_display_max_children', '256'); + ini_set('xdebug.var_display_max_data', '10024'); + $this->drupalGet(''); + $assert_session = $this->assertSession(); + + $webAssert = new WebAssert($this->getSession()); + $element = $webAssert->elementExists('css', 'html'); + $actual = $element->getHtml(); + var_dump($actual); + + $assert_session->elementExists('css', 'div.site-name.h1.text-white.text-decoration-none.align-bottom'); + + } + +}