public function ToolbarAdminMenuTest::testExternalLink in Drupal 8
Same name and namespace in other branches
- 9 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 395
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
->drupalPostForm('admin/structure/menu/manage/admin/add', $edit, 'Save');
// Assert that the new menu link is shown on the menu link listing.
$this
->drupalGet('admin/structure/menu/manage/admin');
$this
->assertText('External URL');
// Assert that the new menu link is shown in the toolbar on a regular page.
$this
->drupalGet(Url::fromRoute('<front>'));
$this
->assertText('External URL');
// Ensure the description is escaped as expected.
$this
->assertRaw('title="External URL & escaped"');
}