Skip to content

Commit

Permalink
OEL-450: Add test SiteBrandingBlockTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
abel-santos-corral committed Sep 7, 2021
1 parent 35eb6d8 commit 8f04580
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 23 deletions.
1 change: 0 additions & 1 deletion .phpunit.result.cache

This file was deleted.

17 changes: 0 additions & 17 deletions config/install/oe_whitelabel.settings.yml

This file was deleted.

5 changes: 0 additions & 5 deletions config/schema/oe_whitelabel.schema.yml

This file was deleted.

78 changes: 78 additions & 0 deletions tests/Functional/SiteBrandingBlockTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?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();

// 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('<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');

}

}

0 comments on commit 8f04580

Please sign in to comment.