You are here

function MenuRouterTestCase::testMenuName in Drupal 7

Tests for menu_name parameter for hook_menu().

File

modules/simpletest/tests/menu.test, line 394
Provides SimpleTests for menu.inc.

Class

MenuRouterTestCase

Code

function testMenuName() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
  ));
  $this
    ->drupalLogin($admin_user);
  $sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
  $name = db_query($sql)
    ->fetchField();
  $this
    ->assertEqual($name, 'original', 'Menu name is "original".');

  // Change the menu_name parameter in menu_test.module, then force a menu
  // rebuild.
  menu_test_menu_name('changed');
  menu_rebuild();
  $sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
  $name = db_query($sql)
    ->fetchField();
  $this
    ->assertEqual($name, 'changed', 'Menu name was successfully changed after rebuild.');
}