You are here

function MenuModuleTestCase::uiCreateLink in SimpleTest 6

Create a menu link using the menu module UI.

2 calls to MenuModuleTestCase::uiCreateLink()
MenuModuleCustomMenuTest::testCreateCheckDelete in tests/menu_module.test
MenuModuleTestCase::testCreateCheckDelete in tests/menu_module.test

File

tests/menu_module.test, line 61

Class

MenuModuleTestCase

Code

function uiCreateLink($plid = 0, $menu_name = 'navigation') {
  $this
    ->drupalGet("admin/build/menu-customize/{$menu_name}/add");
  $this
    ->assertResponse(200);
  $title = '!link_' . $this
    ->randomName(16);
  $edit = array(
    'menu[link_path]' => '<front>',
    'menu[link_title]' => $title,
    'menu[description]' => '',
    'menu[parent]' => $menu_name . ':' . $plid,
    'menu[weight]' => '0',
  );
  $this
    ->drupalPost("admin/build/menu-customize/" . $menu_name . "/add", $edit, "Save");
  $out = $this
    ->drupalGet("admin/build/menu-customize/{$menu_name}");
  $this
    ->assertText($title, 'Link created');
  $mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_title = '%s'", $title));
  return $mlid;
}