function MenuTestCase::verifyMenuLink

7.x menu.test MenuTestCase::verifyMenuLink($item, $item_node, $parent = NULL, $parent_node = NULL)

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 drupal-7.x/modules/menu/menu.test
Test menu functionality using navigation menu.
MenuTestCase::testMenu in drupal-7.x/modules/menu/menu.test
Login users, add menus and menu links, and test menu functionality through the admin and user interfaces.

File

drupal-7.x/modules/menu/menu.test, line 339
Tests for menu.module.

Class

MenuTestCase

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');
}