function MemCacheRealWorldCase::addMenuLink in Zircon Profile 8
Same name and namespace in other branches
- 8.0 modules/memcache/tests/memcache.test \MemCacheRealWorldCase::addMenuLink()
 
Adds a menu link.
See also
MenuTestCase::addMenuLink()
1 call to MemCacheRealWorldCase::addMenuLink()
- MemCacheRealWorldCase::testMenu in modules/
memcache/ tests/ memcache.test  - Test if the menu module caching acts as expected.
 
File
- modules/
memcache/ tests/ memcache.test, line 561  
Class
- MemCacheRealWorldCase
 - Test some real world cache scenarios with default modules.
 
Code
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' => '',
    'enabled' => TRUE,
    // Use this to disable the menu and test.
    'expanded' => TRUE,
    // Setting this to true should test whether it works when we do the std_user tests.
    '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;
}