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

Class

MenuUiTest
Tests the menu UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

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

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