function MenuRouterTestCase::testMenuName

Tests for menu_name parameter for hook_menu().

File

modules/simpletest/tests/menu.test, line 394

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.