You are here

function MenuTest::deleteMenuLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/menu_ui/src/Tests/MenuTest.php \Drupal\menu_ui\Tests\MenuTest::deleteMenuLink()

Deletes a menu link using the UI.

Parameters

\Drupal\menu_link_content\Entity\MenuLinkContent $item: Menu link.

1 call to MenuTest::deleteMenuLink()
MenuTest::testMenu in core/modules/menu_ui/src/Tests/MenuTest.php
Tests menu functionality using the admin and user interfaces.

File

core/modules/menu_ui/src/Tests/MenuTest.php, line 802
Contains \Drupal\menu_ui\Tests\MenuTest.

Class

MenuTest
Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.

Namespace

Drupal\menu_ui\Tests

Code

function deleteMenuLink(MenuLinkContent $item) {
  $mlid = $item
    ->id();
  $title = $item
    ->getTitle();

  // Delete menu link.
  $this
    ->drupalPostForm("admin/structure/menu/item/{$mlid}/delete", array(), t('Delete'));
  $this
    ->assertResponse(200);
  $this
    ->assertRaw(t('The menu link %title has been deleted.', array(
    '%title' => $title,
  )), 'Menu link was deleted');

  // Verify deletion.
  $this
    ->drupalGet('');
  $this
    ->assertNoText($title, 'Menu link was deleted');
}