You are here

public static function MenuLinkMock::create in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Menu/MenuLinkMock.php \Drupal\Tests\Core\Menu\MenuLinkMock::create()
  2. 9 core/tests/Drupal/Tests/Core/Menu/MenuLinkMock.php \Drupal\Tests\Core\Menu\MenuLinkMock::create()

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

6 calls to MenuLinkMock::create()
MenuActiveTrailTest::provider in core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php
Provides test data for all test methods.
MenuLinkTreeElementTest::testConstruction in core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php
Tests construction.
MenuLinkTreeElementTest::testCount in core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php
Tests count().
MenuLinkTreeTest::providerTestBuildCacheability in core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php
Provides the test cases to test for ::testBuildCacheability().
MenuLinkTreeTest::testCreateLinksInMenu in core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
Tests creating links with an expected tree structure.

... See full list

File

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

Class

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

Namespace

Drupal\Tests\Core\Menu

Code

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