function MenuUiTest::toggleMenuLink

Same name in other branches
  1. 9 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::toggleMenuLink()
  2. 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::toggleMenuLink()
  3. 11.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::toggleMenuLink()

Alternately disables and enables a menu link.

Parameters

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

1 call to MenuUiTest::toggleMenuLink()
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 824

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 toggleMenuLink(MenuLinkContent $item) {
    $this->disableMenuLink($item);
    // Verify menu link is absent.
    $this->drupalGet('');
    $this->assertNoText($item->getTitle(), 'Menu link was not displayed');
    $this->enableMenuLink($item);
    // Verify menu link is displayed.
    $this->drupalGet('');
    $this->assertText($item->getTitle(), 'Menu link was displayed');
}

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