You are here

public function MenuUiTest::moveMenuLink in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::moveMenuLink()

Changes the parent of a menu link using the UI.

Parameters

\Drupal\menu_link_content\MenuLinkContent $item: The menu link item to move.

int $parent: The id of the new parent.

string $menu_name: The menu the menu link will be moved to.

1 call to MenuUiTest::moveMenuLink()
MenuUiTest::doMenuTests in core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
Tests menu functionality.

File

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

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\Functional

Code

public function moveMenuLink(MenuLinkContent $item, $parent, $menu_name) {
  $mlid = $item
    ->id();
  $edit = [
    'menu_parent' => $menu_name . ':' . $parent,
  ];
  $this
    ->drupalGet("admin/structure/menu/item/{$mlid}/edit");
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}