You are here

function MenuRouterTestCase::testMenuItemHooks in Drupal 7

Test menu maintenance hooks.

File

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

Class

MenuRouterTestCase

Code

function testMenuItemHooks() {

  // Create an item.
  menu_link_maintain('menu_test', 'insert', 'menu_test_maintain/4', 'Menu link #4');
  $this
    ->assertEqual(menu_test_static_variable(), 'insert', 'hook_menu_link_insert() fired correctly');

  // Update the item.
  menu_link_maintain('menu_test', 'update', 'menu_test_maintain/4', 'Menu link updated');
  $this
    ->assertEqual(menu_test_static_variable(), 'update', 'hook_menu_link_update() fired correctly');

  // Delete the item.
  menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/4', '');
  $this
    ->assertEqual(menu_test_static_variable(), 'delete', 'hook_menu_link_delete() fired correctly');
}