1 menu.test MenuTestCase::testMenu()

Login users, add menus and menu links, and test menu functionality through the admin and user interfaces.


core/modules/menu/tests/menu.test, line 36
Tests for menu.module.




function testMenu() {
  // Login the user.
  $this->items = array();

  // Add Main menu block into sidebar.
  $layout = layout_load('default');
  $layout->addBlock('system', 'main-menu', 'sidebar');

  // Do standard menu tests.

  // Do custom menu tests.

  // Do standard user tests.
  // Login the user.
  foreach ($this->items as $item) {
    $node = node_load(substr($item['link_path'], 5)); // Paths were set as 'node/$nid'.
    $this->verifyMenuLink($item, $node);

  // Login the user.

  // Delete menu links.
  foreach ($this->items as $item) {

  // Delete custom menu.

  // Modify and reset a standard menu link.
  $item = $this->getStandardMenuLink();
  $old_title = $item['link_title'];
  $item = menu_link_load($item['mlid']);
  // Verify that a change to the description is saved.
  $description = $this->randomName(16);
  $item['options']['attributes']['title'] = $description;
  $saved_item = menu_link_load($item['mlid']);
  $this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
  $this->resetMenuLink($item, $old_title);

  // Test for the correct behavior of user menu titles.
  config_set('system.core', 'user_register', USER_REGISTER_VISITORS);
  $this->addMenuLink(0, 'user/register', 'user-menu');
  $this->assertTitle('Create new account | Backdrop CMS');
  $this->assertTitle('Reset password | Backdrop CMS');
  $this->assertTitle('Log in | Backdrop CMS');
  $this->assertTitle('Log in | Backdrop CMS');