function MenuTestCase::verifyMenuLink
Verify a menu link using the menu module UI.
Parameters
array $item Menu link.:
object $item_node Menu link content node.:
array $parent Parent menu link.:
object $parent_node Parent menu link content node.:
2 calls to MenuTestCase::verifyMenuLink()
- MenuTestCase::doMenuTests in modules/
menu/ menu.test - Test menu functionality using navigation menu.
- MenuTestCase::testMenu in modules/
menu/ menu.test - Login users, add menus and menu links, and test menu functionality through the admin and user interfaces.
File
-
modules/
menu/ menu.test, line 380
Class
- MenuTestCase
- @file Tests for menu.module.
Code
function verifyMenuLink($item, $item_node, $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['link_title'];
$this->assertLink($title, 0, 'Parent menu link was displayed');
// Verify menu link link.
$this->clickLink($title);
$title = $parent_node->title;
$this->assertTitle(t("@title | Drupal", array(
'@title' => $title,
)), 'Parent menu link link target was correct');
}
// Verify menu link.
$title = $item['link_title'];
$this->assertLink($title, 0, 'Menu link was displayed');
// Verify menu link link.
$this->clickLink($title);
$title = $item_node->title;
$this->assertTitle(t("@title | Drupal", array(
'@title' => $title,
)), 'Menu link link target was correct');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.