diff -u b/tests/src/Functional/MenuBlockTest.php b/tests/src/Functional/MenuBlockTest.php --- b/tests/src/Functional/MenuBlockTest.php +++ b/tests/src/Functional/MenuBlockTest.php @@ -461,30 +461,32 @@ /** * Test menu block label type options. - * - * @dataProvider testMenuBlockTitltOptionsDataProvider */ - public function testMenuBlockTitleOptions($option, $title, $test_link = NULL) { + public function testMenuBlockTitleOptions() { + // Create a block, and edit it repeatedly to test the title display options. $block_id = 'main'; $this->drupalPostForm('admin/structure/block/add/menu_block:main', [ 'id' => $block_id, 'settings[label]' => 'Block title', 'settings[label_display]' => TRUE, 'settings[parent]' => 'main:' . $this->links['child-1'], - 'settings[label_type]' => $option, 'region' => 'primary_menu', ], 'Save block'); - if (!$test_link) { - $test_link = 'menu-block-test/hierarchy/parent/child-1/child-1-1'; + $options = $this->getTestMenuBlockTitltOptions(); + foreach ($options as $option) { + $this->drupalPostForm('admin/structure/block/manage/main', [ + 'settings[label_type]' => $option['option'], + ], 'Save block'); + $test_link = empty($option['test_link']) ? 'menu-block-test/hierarchy/parent/child-1/child-1-1' : $option['test_link']; + $this->drupalGet($test_link); + $this->assertSession()->elementTextContains('css', 'h2#block-main-menu', $option['title']); } - $this->drupalGet($test_link); - $this->assertSession()->elementTextContains('css', '#block-main-menu', $title); } /** * Provides test data for testMenuBlockTitleOptions(). */ - public function testMenuBlockTitltOptionsDataProvider() { + protected function getTestMenuBlockTitltOptions() { return [ [ 'option' => MenuBlock::LABEL_BLOCK, @@ -499,6 +501,11 @@ 'title' => 'child-1 menu item' ], [ + 'option' => MenuBlock::LABEL_FIXED_PARENT, + 'title' => 'child-1 menu item', + 'test_link' => 'menu-block-test/hierarchy/parent' + ], + [ 'option' => MenuBlock::LABEL_ACTIVE_ITEM, 'title' => 'child-1-1 menu item', ], @@ -517,13 +524,18 @@ 'test_link' => 'menu-block-test/hierarchy/parent/child-1/child-1-2', ], [ + 'option' => MenuBlock::LABEL_PARENT, + 'title' => 'parent menu item', + 'test_link' => 'menu-block-test/hierarchy/parent', + ], + [ 'option' => MenuBlock::LABEL_ROOT, 'title' => 'parent menu item' ], [ 'option' => MenuBlock::LABEL_ROOT, 'title' => 'parent menu item', - 'test_link' => 'menu-block-test/hierarchy/parent/child-1/child-1-1', + 'test_link' => 'menu-block-test/hierarchy/parent/child-1/child-1-2', ], [ 'option' => MenuBlock::LABEL_ROOT,