public function MenuUiTest::deleteMenuLink in Drupal 8
Same name and namespace in other branches
- 9 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::testMenu 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 804
Class
- MenuUiTest
- 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\Tests\menu_ui\FunctionalCode
public function deleteMenuLink(MenuLinkContent $item) {
$mlid = $item
->id();
$title = $item
->getTitle();
// Delete menu link.
$this
->drupalPostForm("admin/structure/menu/item/{$mlid}/delete", [], t('Delete'));
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertRaw(t('The menu link %title has been deleted.', [
'%title' => $title,
]), 'Menu link was deleted');
// Verify deletion.
$this
->drupalGet('');
$this
->assertNoText($title, 'Menu link was deleted');
}