function MenuUiTest::getStandardMenuLink

Same name in other branches
  1. 9 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::testMenu 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 931

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

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.