You are here

function MenuModuleCustomMenuTest::testCreateCheckDelete in SimpleTest 6

Overrides MenuModuleTestCase::testCreateCheckDelete

File

tests/menu_module.test, line 106

Class

MenuModuleCustomMenuTest

Code

function testCreateCheckDelete() {
  $web_user = $this
    ->drupalCreateUserRolePerm(array(
    'access content',
    'administer menu',
    'access administration pages',
  ));
  $this
    ->drupalLoginUser($web_user);
  $this
    ->drupalGet('admin/build/menu/add');
  $name = substr(md5($this
    ->randomName(16)), 0, 20);
  $title = $this
    ->randomName(16);
  $edit = array(
    'menu_name' => $name,
    'description' => '',
    'title' => $title,
  );
  $this
    ->drupalPost("admin/build/menu/add", $edit, "Save");
  $name = 'menu-' . $name;
  $this
    ->drupalGet('admin/build/menu');
  $this
    ->assertText($title, 'Menu created');
  $mlid1 = $this
    ->uiCreateLink(0, $name);
  $link1 = menu_link_load($mlid1);
  $this
    ->assertTrue((bool) $link1, '1st link created and loaded');
  $this
    ->drupalPost("admin/build/menu-customize/" . $name . "/delete", array(), "Delete");
  $this
    ->assertFalse(menu_load($name), 'Custom menu deleted');
  $this
    ->assertFalse(menu_link_load($mlid1), '1st link deleted with menu');
}