Login users, add menus and menu links, and test menu functionality through the admin and user interfaces.
function testMenu() {
// Login the user.
$this
->drupalLogin($this->big_user);
$this->items = array();
$this->menu = $this
->addCustomMenu();
$this
->doMenuTests($this->menu
->id());
$this
->addInvalidMenuLink($this->menu
->id());
$this
->addCustomMenuCRUD();
// Do standard user tests.
// Login the user.
$this
->drupalLogin($this->std_user);
$this
->verifyAccess(403, $this->menu
->id());
foreach ($this->items as $item) {
$node = node_load(substr($item['link_path'], 5));
// Paths were set as 'node/$nid'.
$this
->verifyMenuLink($item, $node);
}
// Login the user.
$this
->drupalLogin($this->big_user);
// Delete menu links.
foreach ($this->items as $item) {
$this
->deleteMenuLink($item);
}
// Delete custom menu.
$this
->deleteCustomMenu($this->menu);
// Modify and reset a standard menu link.
$item = $this
->getStandardMenuLink();
$old_title = $item['link_title'];
$this
->modifyMenuLink($item);
$item = entity_load('menu_link', $item['mlid']);
// Verify that a change to the description is saved.
$description = $this
->randomName(16);
$item['options']['attributes']['title'] = $description;
$return_value = menu_link_save($item);
// Save the menu link again to test the return value of the procedural save
// helper.
$this
->assertIdentical($return_value, $item
->save(), 'Return value of menu_link_save() is identical to the return value of $menu_link->save().');
$saved_item = entity_load('menu_link', $item['mlid']);
$this
->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
$this
->resetMenuLink($item, $old_title);
}