function MenuLinkMock::createMock

Create an instance from a definition with at least id, title, route_name.

13 calls to MenuLinkMock::createMock()
DefaultMenuLinkTreeManipulatorsTest::mockTree in core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
Creates a mock tree.
DefaultMenuLinkTreeManipulatorsTest::testCheckNodeAccess in core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
Tests the optimized node access checking.
MenuActiveTrailTest::provider in core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
Provides test data for all test methods.
MenuActiveTrailTest::testGetActiveLinkReturnsFrontPageLinkAtTheFrontPage in core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
Tests that getActiveLink() returns a <front> route link for a route that is the front page and has no other links.
MenuLinkTreeElementTest::testConstruction in core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php
Tests construction.

... See full list

File

core/tests/Drupal/Tests/Core/Menu/MenuLinkMock.php, line 48

Class

MenuLinkMock
Defines a mock implementation of a menu link used in tests only.

Namespace

Drupal\Tests\Core\Menu

Code

public static function createMock($definition) : static {
  return new static([], $definition['id'], $definition + static::$defaults);
}

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