function MenuUiTest::verifyAddChildLink

Same name in other branches
  1. 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::verifyAddChildLink()

Verifies that the "Add child" link selects the correct parent item.

Parameters

\Drupal\menu_link_content\Entity\MenuLinkContent $item: Menu link entity.

1 call to MenuUiTest::verifyAddChildLink()
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 947

Class

MenuUiTest
Tests the menu UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

public function verifyAddChildLink(MenuLinkContent $item) : void {
    $menu_name = $item->getMenuName();
    $this->drupalGet('admin/structure/menu/manage/' . $menu_name);
    $links = $this->xpath('//a[normalize-space()=:item_label]/following::a[normalize-space()=:link_label]', [
        ':item_label' => $item->getTitle(),
        ':link_label' => 'Add child',
    ]);
    $links[0]->click();
    $option = $this->assertSession()
        ->optionExists('edit-menu-parent', $menu_name . ':' . $item->getPluginId());
    $this->assertTrue($option->isSelected());
}

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