function MenuRouterTest::doTestHookMenuIntegration
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::doTestHookMenuIntegration()
- 10 core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::doTestHookMenuIntegration()
- 11.x core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::doTestHookMenuIntegration()
Tests local tasks with route placeholders.
1 call to MenuRouterTest::doTestHookMenuIntegration()
- MenuRouterTest::testMenuIntegration in core/
modules/ system/ tests/ src/ Functional/ Menu/ MenuRouterTest.php - Tests menu integration.
File
-
core/
modules/ system/ tests/ src/ Functional/ Menu/ MenuRouterTest.php, line 63
Class
- MenuRouterTest
- Tests menu router and default menu link functionality.
Namespace
Drupal\Tests\system\Functional\MenuCode
protected function doTestHookMenuIntegration() {
// Generate base path with random argument.
$machine_name = $this->randomMachineName(8);
$base_path = 'foo/' . $machine_name;
$this->drupalGet($base_path);
// Confirm correct controller activated.
$this->assertSession()
->pageTextContains('test1');
// Confirm local task links are displayed.
$this->assertSession()
->linkExists('Local task A');
$this->assertSession()
->linkExists('Local task B');
$this->assertSession()
->linkNotExists('Local task C');
$this->assertSession()
->assertEscaped("<script>alert('Welcome to the jungle!')</script>");
// Confirm correct local task href.
$this->assertSession()
->linkByHrefExists(Url::fromRoute('menu_test.router_test1', [
'bar' => $machine_name,
])->toString());
$this->assertSession()
->linkByHrefExists(Url::fromRoute('menu_test.router_test2', [
'bar' => $machine_name,
])->toString());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.