Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 71531786 authored by drishu's avatar drishu Committed by escuriola
Browse files

OEL-455: Fix test.

parent 0951f2ab
No related branches found
No related tags found
1 merge request!10OEL-455 [oe_whitelabel] footer
<h4> {{ eu_institutions_title| t }} </h4> <h4> {{ eu_institutions_title|t }} </h4>
{{ eu_institutions_links }}
{% if eu_institutions_links is defined and eu_institutions_links is not empty and eu_institutions_links is iterable %} {% if eu_institutions_links is defined and eu_institutions_links is not empty and eu_institutions_links is iterable %}
<ul class="nav flex-column"> <ul class="nav flex-column">
{% for eu_link in eu_institutions_links %} {% for eu_link in eu_institutions_links %}
......
...@@ -4,13 +4,13 @@ declare(strict_types = 1); ...@@ -4,13 +4,13 @@ declare(strict_types = 1);
namespace Drupal\Tests\oe_whitelabel\Kernel; namespace Drupal\Tests\oe_whitelabel\Kernel;
use Drupal\KernelTests\KernelTestBase; use Drupal\Tests\sparql_entity_storage\Kernel\SparqlKernelTestBase;
use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Crawler;
/** /**
* Tests the EU and the EC corporate Footer blocks rendering. * Tests the EU and the EC corporate Footer blocks rendering.
*/ */
class FooterBlockTest extends KernelTestBase { class FooterBlockTest extends SparqlKernelTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
...@@ -18,12 +18,15 @@ class FooterBlockTest extends KernelTestBase { ...@@ -18,12 +18,15 @@ class FooterBlockTest extends KernelTestBase {
protected static $modules = [ protected static $modules = [
'block', 'block',
'components', 'components',
'oe_whitelabel_helper',
'oe_whitelabel_footer',
'ui_patterns', 'ui_patterns',
'ui_patterns_library', 'ui_patterns_library',
'user', 'user',
'system', 'system',
'oe_whitelabel_helper',
'oe_corporate_site_info',
'oe_corporate_blocks',
'rdf_skos',
'multivalue_form_element',
]; ];
/** /**
...@@ -31,7 +34,12 @@ class FooterBlockTest extends KernelTestBase { ...@@ -31,7 +34,12 @@ class FooterBlockTest extends KernelTestBase {
*/ */
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
$this->installConfig([
'oe_corporate_site_info',
'oe_corporate_blocks',
]);
\Drupal::service('theme_installer')->install(['oe_whitelabel']); \Drupal::service('theme_installer')->install(['oe_whitelabel']);
\Drupal::configFactory() \Drupal::configFactory()
...@@ -41,6 +49,8 @@ class FooterBlockTest extends KernelTestBase { ...@@ -41,6 +49,8 @@ class FooterBlockTest extends KernelTestBase {
$this->container->set('theme.registry', NULL); $this->container->set('theme.registry', NULL);
$this->container->get('cache.render')->deleteAll(); $this->container->get('cache.render')->deleteAll();
\Drupal::service('kernel')->rebuildContainer();
} }
/** /**
...@@ -65,13 +75,13 @@ class FooterBlockTest extends KernelTestBase { ...@@ -65,13 +75,13 @@ class FooterBlockTest extends KernelTestBase {
$builder = \Drupal::entityTypeManager()->getViewBuilder('block'); $builder = \Drupal::entityTypeManager()->getViewBuilder('block');
$build = $builder->view($entity, 'block'); $build = $builder->view($entity, 'block');
$render = $this->container->get('renderer')->renderRoot($build); $render = $this->container->get('renderer')->renderRoot($build);
var_dump($render);
$crawler = new Crawler($render->__toString()); $crawler = new Crawler($render->__toString());
$actual = $crawler->filter('footer'); // For now we assert only minimal till we have a footer component.
$actual = $crawler->filter('#block-ecfooterblock');
$this->assertCount(1, $actual); $this->assertCount(1, $actual);
$sections = $actual->filter('.footer-section'); $sections = $actual->filter('.row');
$this->assertCount(3, $sections); $this->assertCount(2, $sections);
} }
/** /**
...@@ -98,10 +108,11 @@ class FooterBlockTest extends KernelTestBase { ...@@ -98,10 +108,11 @@ class FooterBlockTest extends KernelTestBase {
$render = $this->container->get('renderer')->renderRoot($build); $render = $this->container->get('renderer')->renderRoot($build);
$crawler = new Crawler($render->__toString()); $crawler = new Crawler($render->__toString());
$actual = $crawler->filter('footer'); // For now we assert only minimal till we have a footer component.
$actual = $crawler->filter('#block-eufooterblock');
$this->assertCount(1, $actual); $this->assertCount(1, $actual);
$sections = $actual->filter('.footer-section'); $sections = $actual->filter('.row');
$this->assertCount(6, $sections); $this->assertCount(2, $sections);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment