-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OEL-450: Add test SiteBrandingBlockTest.
- Loading branch information
1 parent
35eb6d8
commit 6e0a3d8
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Drupal\Tests\oe_whitelabel\Functional; | ||
|
||
use Drupal\Tests\BrowserTestBase; | ||
use Drupal\Tests\WebAssert; | ||
|
||
/** | ||
* Tests of Site Branding Block. | ||
*/ | ||
class SiteBrandingBlockTest extends BrowserTestBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static $modules = [ | ||
'config', | ||
'system', | ||
'ui_patterns', | ||
'ui_patterns_library', | ||
'ui_patterns_settings', | ||
'components', | ||
'field_ui', | ||
'toolbar', | ||
'block', | ||
]; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected $defaultTheme = 'stark'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function setUp(): void { | ||
parent::setUp(); | ||
|
||
// Enable and set OpenEuropa Whitelabel Theme as default. | ||
\Drupal::service('theme_installer')->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(); | ||
|
||
} | ||
|
||
/** | ||
* Asserts classes contained at site branding block. | ||
*/ | ||
public function testClassesSiteName(): void { | ||
$this->drupalGet('<front>'); | ||
$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'); | ||
|
||
} | ||
|
||
} |