function MenuTest::verifyMenuLink in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/menu_ui/src/Tests/MenuTest.php \Drupal\menu_ui\Tests\MenuTest::verifyMenuLink()
Verifies a menu link using the UI.
Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent $item: Menu link.
object $item_node: Menu link content node.
\Drupal\menu_link_content\Entity\MenuLinkContent $parent: Parent menu link.
object $parent_node: Parent menu link content node.
2 calls to MenuTest::verifyMenuLink()
- MenuTest::doMenuTests in core/
modules/ menu_ui/ src/ Tests/ MenuTest.php - Tests menu functionality.
- MenuTest::testMenu in core/
modules/ menu_ui/ src/ Tests/ MenuTest.php - Tests menu functionality using the admin and user interfaces.
File
- core/
modules/ menu_ui/ src/ Tests/ MenuTest.php, line 707 - Contains \Drupal\menu_ui\Tests\MenuTest.
Class
- MenuTest
- Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.
Namespace
Drupal\menu_ui\TestsCode
function verifyMenuLink(MenuLinkContent $item, $item_node, MenuLinkContent $parent = NULL, $parent_node = NULL) {
// View home page.
$this
->drupalGet('');
$this
->assertResponse(200);
// Verify parent menu link.
if (isset($parent)) {
// Verify menu link.
$title = $parent
->getTitle();
$this
->assertLink($title, 0, 'Parent menu link was displayed');
// Verify menu link link.
$this
->clickLink($title);
$title = $parent_node
->label();
$this
->assertTitle(t("@title | Drupal", array(
'@title' => $title,
)), 'Parent menu link link target was correct');
}
// Verify menu link.
$title = $item
->getTitle();
$this
->assertLink($title, 0, 'Menu link was displayed');
// Verify menu link link.
$this
->clickLink($title);
$title = $item_node
->label();
$this
->assertTitle(t("@title | Drupal", array(
'@title' => $title,
)), 'Menu link link target was correct');
}