You are here

function MenuTest::moveMenuLink in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/src/Tests/MenuTest.php \Drupal\menu_ui\Tests\MenuTest::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 MenuTest::moveMenuLink()
MenuTest::doMenuTests in core/modules/menu_ui/src/Tests/MenuTest.php
Tests menu functionality.

File

core/modules/menu_ui/src/Tests/MenuTest.php, line 744
Contains \Drupal\menu_ui\Tests\MenuTest.

Class

MenuTest
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\menu_ui\Tests

Code

function moveMenuLink(MenuLinkContent $item, $parent, $menu_name) {
  $mlid = $item
    ->id();
  $edit = array(
    'menu_parent' => $menu_name . ':' . $parent,
  );
  $this
    ->drupalPostForm("admin/structure/menu/item/{$mlid}/edit", $edit, t('Save'));
  $this
    ->assertResponse(200);
}