You are here

function MenuTestCase::deleteMenuLink in Drupal 7

Delete a menu link using the menu module UI.

Parameters

array $item Menu link.:

1 call to MenuTestCase::deleteMenuLink()
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 469
Tests for menu.module.

Class

MenuTestCase
@file Tests for menu.module.

Code

function deleteMenuLink($item) {
  $mlid = $item['mlid'];
  $title = $item['link_title'];

  // Delete menu link.
  $this
    ->drupalPost("admin/structure/menu/item/{$mlid}/delete", array(), t('Confirm'));
  $this
    ->assertResponse(200);
  $this
    ->assertRaw(t('The menu link %title has been deleted.', array(
    '%title' => $title,
  )), 'Menu link was deleted');

  // Verify deletion.
  $this
    ->drupalGet('');
  $this
    ->assertNoText($title, 'Menu link was deleted');
}