You are here

public function MenuUiTest::moveMenuLink in Drupal 8

Same name and namespace in other branches
  1. 9 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\MenuLinkContentInterface $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 746

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
    ->drupalPostForm("admin/structure/menu/item/{$mlid}/edit", $edit, t('Save'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}