You are here

function MenuTestCase::deleteCustomMenu in Drupal 7

Delete custom menu.

Parameters

string $menu_name Custom menu name.:

1 call to MenuTestCase::deleteCustomMenu()
MenuTestCase::testMenu in modules/menu/menu.test
Login users, add menus and menu links, and test menu functionality through the admin and user interfaces.

File

modules/menu/menu.test, line 191
Tests for menu.module.

Class

MenuTestCase
@file Tests for menu.module.

Code

function deleteCustomMenu($menu) {
  $menu_name = $this->menu['menu_name'];
  $title = $this->menu['title'];

  // Delete custom menu.
  $this
    ->drupalPost("admin/structure/menu/manage/{$menu_name}/delete", array(), t('Delete'));
  $this
    ->assertResponse(200);
  $this
    ->assertRaw(t('The custom menu %title has been deleted.', array(
    '%title' => $title,
  )), 'Custom menu was deleted');
  $this
    ->assertFalse(menu_load($menu_name), 'Custom menu was deleted');

  // Test if all menu links associated to the menu were removed from database.
  $result = db_query("SELECT menu_name FROM {menu_links} WHERE menu_name = :menu_name", array(
    ':menu_name' => $menu_name,
  ))
    ->fetchField();
  $this
    ->assertFalse($result, 'All menu links associated to the custom menu were deleted.');
}