You are here

function MenuTest::toggleMenuLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/menu_ui/src/Tests/MenuTest.php \Drupal\menu_ui\Tests\MenuTest::toggleMenuLink()

Alternately disables and enables a menu link.

Parameters

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

1 call to MenuTest::toggleMenuLink()
MenuTest::doMenuTests in core/modules/menu_ui/src/Tests/MenuTest.php
Tests menu functionality.

File

core/modules/menu_ui/src/Tests/MenuTest.php, line 822
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 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');
}