function MenuUiTest::deleteMenuLink

Same name in other branches
  1. 9 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::deleteMenuLink()
  2. 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::deleteMenuLink()
  3. 11.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::deleteMenuLink()

Deletes a menu link using the UI.

Parameters

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

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

File

core/modules/menu_ui/tests/src/Functional/MenuUiTest.php, line 987

Class

MenuUiTest
Tests the menu UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

public function deleteMenuLink(MenuLinkContent $item) {
    $menu_link_id = $item->id();
    $title = $item->getTitle();
    // Delete menu link.
    $this->drupalGet("admin/structure/menu/item/{$menu_link_id}/delete");
    $this->submitForm([], 'Delete');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->pageTextContains("The menu link {$title} has been deleted.");
    // Verify deletion.
    $this->drupalGet('');
    $this->assertSession()
        ->pageTextNotContains($title);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.