1 menu.test public MenuChangeTestCase::testMenuChangeTypeTestCase()

Test that updating the type of a menu item works correctly.

File

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

Class

MenuChangeTestCase
Tests menu changes.

Code

public function testMenuChangeTypeTestCase() {
  // Check that the test menu item exists.
  $sql = "SELECT type FROM {menu_links}, {menu_router} WHERE {menu_links}.router_path = {menu_router}.path AND {menu_links}.router_path = 'menu-test/changes'";
  $type = db_query($sql)->fetchField();
  $this->assertEqual($type, MENU_NORMAL_ITEM, t('Menu item exists and is type MENU_NORMAL_ITEM.'));

  // Change item type to MENU_CALLBACK and rebuild menu.
  menu_test_change_menu_type('callback');
  menu_rebuild();

  $result = db_query($sql)->rowCount();
  $this->assertEqual($result, 0, t('Menu item no longer exists in menu_links table after menu_rebuild.'));
}