diff --git a/modules/oe_whitelabel_helper/oe_whitelabel_helper.module b/modules/oe_whitelabel_helper/oe_whitelabel_helper.module index 57670247301aa5173e8dd5c1f93fd169be2f6586..b4efc1f19de164c619ec5d1c16b12f881bb976df 100644 --- a/modules/oe_whitelabel_helper/oe_whitelabel_helper.module +++ b/modules/oe_whitelabel_helper/oe_whitelabel_helper.module @@ -26,5 +26,15 @@ function oe_whitelabel_helper_theme($existing, $type, $theme, $path) { 'address_delimiter' => NULL, ], ], + 'oe_corporate_blocks_neutral_footer' => [ + 'variables' => [ + 'corporate_footer' => [], + 'site_specific_footer' => [], + ], + 'preprocess functions' => [ + 'oe_corporate_blocks_preprocess_set_site_owner', + ], + ], ]; } + diff --git a/modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php b/modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php index f1a7c1a67166a0ea9e08166ff1b0b8671782d6b5..03ef209c3a7e1977fe2bed3cf478935f5f7021c1 100644 --- a/modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php +++ b/modules/oe_whitelabel_helper/src/Plugin/Block/NeutralFooterBlock.php @@ -10,7 +10,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\oe_corporate_blocks\Plugin\Block\FooterBlockBase; /** - * Provides the corporate EU footer block. + * Provides the Neutral footer block. * * @Block( * id = "oe_corporate_blocks_neutral_footer", diff --git a/tests/src/Kernel/FooterBlockTest.php b/tests/src/Kernel/FooterBlockTest.php index c201d6d964702bd817048ca05f8bcc87b69dc316..74d63e5c172616e70a5a0ae659c6ed2201217036 100644 --- a/tests/src/Kernel/FooterBlockTest.php +++ b/tests/src/Kernel/FooterBlockTest.php @@ -17,16 +17,12 @@ class FooterBlockTest extends SparqlKernelTestBase { */ protected static $modules = [ 'block', - 'multivalue_form_element', 'oe_bootstrap_theme_helper', 'oe_corporate_blocks', 'oe_corporate_site_info', 'oe_whitelabel_helper', 'rdf_skos', 'system', - 'ui_patterns', - 'ui_patterns_library', - 'ui_patterns_settings', 'user', ]; @@ -63,6 +59,7 @@ class FooterBlockTest extends SparqlKernelTestBase { $crawler = new Crawler($render->__toString()); // For now we assert only minimal till we have a footer component. + $this->assertCount(1, $crawler->filter('footer.bcl-footer--ec')); $rows = $crawler->filter('.row'); $this->assertCount(2, $rows); $borderedSections = $crawler->filter('.bcl-footer__bordered-row'); @@ -98,6 +95,7 @@ class FooterBlockTest extends SparqlKernelTestBase { $crawler = new Crawler($render->__toString()); // For now we assert only minimal till we have a footer component. + $this->assertCount(1, $crawler->filter('footer.bcl-footer--eu')); $rows = $crawler->filter('.row'); $this->assertCount(2, $rows); $borderedSections = $crawler->filter('.bcl-footer__bordered-row'); @@ -108,4 +106,36 @@ class FooterBlockTest extends SparqlKernelTestBase { $this->assertCount(10, $sectionLinks); } + /** + * Tests the rendering of blocks. + */ + public function testNeutralFooterBlockRendering(): void { + $entity_type_manager = $this->container + ->get('entity_type.manager') + ->getStorage('block'); + $entity = $entity_type_manager->create([ + 'id' => 'neutralfooterblock', + 'theme' => 'oe_whitelabel', + 'plugin' => 'oe_corporate_blocks_neutral_footer', + 'settings' => [ + 'id' => 'oe_corporate_blocks_neutral_footer', + 'label' => 'Neutral Footer block', + 'provider' => 'oe_corporate_blocks', + 'label_display' => '0', + ], + ]); + $entity->save(); + $builder = \Drupal::entityTypeManager()->getViewBuilder('block'); + $build = $builder->view($entity, 'block'); + $render = $this->container->get('renderer')->renderRoot($build); + $crawler = new Crawler($render->__toString()); + + // For now we assert only minimal till we have a footer component. + $this->assertCount(1, $crawler->filter('footer.bcl-footer--neutral')); + $rows = $crawler->filter('.row'); + $this->assertCount(1, $rows); + $sectionTitles = $crawler->filter('p.fw-bold.mb-2'); + $this->assertCount(1, $sectionTitles); + } + }