Delete custom menu.
string $menu_name Custom menu name.:
function deleteCustomMenu($menu) {
$menu_name = $this->menu
->id();
$label = $this->menu
->label();
// 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' => $label,
)), '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 = entity_load_multiple_by_properties('menu_link', array(
'menu_name' => $menu_name,
));
$this
->assertFalse($result, 'All menu links associated to the custom menu were deleted.');
// Make sure there's no delete button on system menus.
$this
->drupalGet('admin/structure/menu/manage/main/edit');
$this
->assertNoRaw('edit-delete', 'The delete button was not found');
// Try to delete the main menu.
$this
->drupalGet('admin/structure/menu/manage/main/delete');
$this
->assertText(t('You are not authorized to access this page.'));
}