function MenuUiTest::moveMenuLink

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()
  2. 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::moveMenuLink()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.