You are here

function MenuTestCase::modifyMenuLink in Drupal 7

Modify a menu link using the menu module UI.

Parameters

array $item Menu link passed by reference.:

2 calls to MenuTestCase::modifyMenuLink()
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 425
Tests for menu.module.

Class

MenuTestCase
@file Tests for menu.module.

Code

function modifyMenuLink(&$item) {
  $item['link_title'] = $this
    ->randomName(16);
  $mlid = $item['mlid'];
  $title = $item['link_title'];

  // Edit menu link.
  $edit = array();
  $edit['link_title'] = $title;
  $this
    ->drupalPost("admin/structure/menu/item/{$mlid}/edit", $edit, t('Save'));
  $this
    ->assertResponse(200);

  // Unlike most other modules, there is no confirmation message displayed.
  // Verify menu link.
  $this
    ->drupalGet('admin/structure/menu/manage/' . $item['menu_name']);
  $this
    ->assertText($title, 'Menu link was edited');
}