You are here

function MenuIncTestCase::testMenuName in SimpleTest 7

Tests for menu_name parameter for hook_menu().

File

tests/menu.test, line 183
Provides SimpleTests for menu.inc.

Class

MenuIncTestCase
@file Provides SimpleTests for menu.inc.

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', t('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', t('Menu name was successfully changed after rebuild.'));
}