You are here

public function MemCacheRealWorldCase::addMenuLink in Memcache API and Integration 7

Adds a menu link.

See also

MenuTestCase::addMenuLink()

1 call to MemCacheRealWorldCase::addMenuLink()
MemCacheRealWorldCase::testMenu in tests/memcache.test
Test if the menu module caching acts as expected.

File

tests/memcache.test, line 852
Test cases for the memcache cache backend.

Class

MemCacheRealWorldCase
Test some real world cache scenarios with default modules.

Code

public function addMenuLink($plid = 0, $link = '<front>', $menu_name = 'main-menu') {

  // View add menu link page.
  $this
    ->drupalGet("admin/structure/menu/manage/{$menu_name}/add");
  $this
    ->assertResponse(200);
  $title = '!OriginalLink_' . $this
    ->randomName(16);
  $edit = array(
    'link_path' => $link,
    'link_title' => $title,
    'description' => '',
    // Use this to disable the menu and test.
    'enabled' => TRUE,
    // Setting this to true should test whether it works when we do the
    // std_user tests.
    'expanded' => TRUE,
    'parent' => $menu_name . ':' . $plid,
    'weight' => '0',
  );

  // Add menu link.
  $this
    ->drupalPost(NULL, $edit, t('Save'));
  $this
    ->assertResponse(200);

  // Unlike most other modules, there is no confirmation message displayed.
  $this
    ->assertText($title, 'Menu link was added');
  $item = db_query('SELECT * FROM {menu_links} WHERE link_title = :title', array(
    ':title' => $title,
  ))
    ->fetchAssoc();
  return $item;
}