You are here

private function MenuUiTest::getStandardMenuLink in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::getStandardMenuLink()
  2. 9 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.

File

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

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;
}