protected function MenuRouterTest::doTestHookMenuIntegration in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Menu/MenuRouterTest.php \Drupal\system\Tests\Menu\MenuRouterTest::doTestHookMenuIntegration()
Test local tasks with route placeholders.
1 call to MenuRouterTest::doTestHookMenuIntegration()
- MenuRouterTest::testMenuIntegration in core/
modules/ system/ src/ Tests/ Menu/ MenuRouterTest.php - Tests menu integration.
File
- core/
modules/ system/ src/ Tests/ Menu/ MenuRouterTest.php, line 67 - Contains \Drupal\system\Tests\Menu\MenuRouterTest.
Class
- MenuRouterTest
- Tests menu router and default menu link functionality.
Namespace
Drupal\system\Tests\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
->assertText('test1');
// Confirm local task links are displayed.
$this
->assertLink('Local task A');
$this
->assertLink('Local task B');
$this
->assertNoLink('Local task C');
$this
->assertEscaped("<script>alert('Welcome to the jungle!')</script>", ENT_QUOTES, 'UTF-8');
// Confirm correct local task href.
$this
->assertLinkByHref(Url::fromRoute('menu_test.router_test1', [
'bar' => $machine_name,
])
->toString());
$this
->assertLinkByHref(Url::fromRoute('menu_test.router_test2', [
'bar' => $machine_name,
])
->toString());
}