function MenuUiTest::getStandardMenuLink

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

Returns standard menu link.

Return value

\Drupal\Core\Menu\MenuLinkInterface A menu link plugin.

2 calls to MenuUiTest::getStandardMenuLink()
MenuUiTest::testMenuAdministration in core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
Tests menu functionality using the admin and user interfaces.
MenuUiTest::verifyAccess in core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
Verifies the logged in user has the desired access to various menu pages.

File

core/modules/menu_ui/tests/src/Functional/MenuUiTest.php, line 1026

Class

MenuUiTest
Tests the menu UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

private function getStandardMenuLink() {
    // Retrieve menu link id of the Log out menu link, which will always be on
    // the front page.
    
    /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
    $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
    $instance = $menu_link_manager->getInstance([
        'id' => 'user.logout',
    ]);
    $this->assertTrue((bool) $instance, 'Standard menu link was loaded');
    return $instance;
}

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