function MenuUiTest::modifyMenuLink
Same name in other branches
- 9 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::modifyMenuLink()
- 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::modifyMenuLink()
- 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::modifyMenuLink()
Modifies a menu link using the UI.
Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent $item: Menu link entity.
2 calls to MenuUiTest::modifyMenuLink()
- MenuUiTest::doMenuTests in core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php - Tests menu functionality.
- MenuUiTest::testUnpublishedNodeMenuItem in core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php - Tests that menu items pointing to unpublished nodes are editable.
File
-
core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php, line 923
Class
- MenuUiTest
- Tests the menu UI.
Namespace
Drupal\Tests\menu_ui\FunctionalCode
public function modifyMenuLink(MenuLinkContent $item) : void {
$item->title->value = $this->randomMachineName(16);
$menu_link_id = $item->id();
$title = $item->getTitle();
// Edit menu link.
$edit = [];
$edit['title[0][value]'] = $title;
$this->drupalGet("admin/structure/menu/item/{$menu_link_id}/edit");
$this->submitForm($edit, 'Save');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains('The menu link has been saved.');
// Verify menu link.
$this->drupalGet('admin/structure/menu/manage/' . $item->getMenuName());
$this->assertSession()
->pageTextContains($title);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.