public function ToolbarAdminMenuTest::testExternalLink in Drupal 9
Same name and namespace in other branches
- 8 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testExternalLink()
Tests that external links added to the menu appear in the toolbar.
File
- core/
modules/ toolbar/ tests/ src/ Functional/ ToolbarAdminMenuTest.php, line 418
Class
- ToolbarAdminMenuTest
- Tests the caching of the admin menu subtree items.
Namespace
Drupal\Tests\toolbar\FunctionalCode
public function testExternalLink() {
$edit = [
'title[0][value]' => 'External URL',
'link[0][uri]' => 'http://example.org',
'menu_parent' => 'admin:system.admin',
'description[0][value]' => 'External URL & escaped',
];
$this
->drupalGet('admin/structure/menu/manage/admin/add');
$this
->submitForm($edit, 'Save');
// Assert that the new menu link is shown on the menu link listing.
$this
->drupalGet('admin/structure/menu/manage/admin');
$this
->assertSession()
->pageTextContains('External URL');
// Assert that the new menu link is shown in the toolbar on a regular page.
$this
->drupalGet(Url::fromRoute('<front>'));
$this
->assertSession()
->pageTextContains('External URL');
// Ensure the description is escaped as expected.
$this
->assertSession()
->responseContains('title="External URL & escaped"');
}