public function MenuBlockTitleTest::testThirdLevel in Menu block title 8
Tests that viewing a node in the 3rd level of depth shows the parent as a link as the title of the menu block.
File
- tests/
src/ Functional/ MenuBlockTitleTest.php, line 92
Class
- MenuBlockTitleTest
- Class SettingsPageTest.
Namespace
Drupal\Tests\menu_block_title\FunctionalCode
public function testThirdLevel() {
$href = '/node/6';
$this
->drupalGet('/node/7');
$this
->assertSession()
->elementContains('css', 'h2#block-sidebar-nav-main-menu', 'Child of third item');
$xpath = $this
->assertSession()
->buildXPathQuery('//h2[@id="block-sidebar-nav-main-menu"]/a[contains(@href, :href)]', [
':href' => $href,
]);
$link = $this
->getSession()
->getPage()
->findAll('xpath', $xpath);
$message = strtr('Link containing href %href found.', [
'%href' => $href,
]);
$this
->assertSession()
->assert(!empty($link), $message);
}