You are here

protected function MenuLinkTreeTest::setUp in Drupal 9

Same name in this branch
  1. 9 core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php \Drupal\KernelTests\Core\Menu\MenuLinkTreeTest::setUp()
  2. 9 core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php \Drupal\Tests\system\Unit\Menu\MenuLinkTreeTest::setUp()
Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php \Drupal\Tests\system\Unit\Menu\MenuLinkTreeTest::setUp()
  2. 10 core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php \Drupal\Tests\system\Unit\Menu\MenuLinkTreeTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php, line 31

Class

MenuLinkTreeTest
@coversDefaultClass \Drupal\Core\Menu\MenuLinkTree @group Menu

Namespace

Drupal\Tests\system\Unit\Menu

Code

protected function setUp() : void {
  parent::setUp();
  $this->menuLinkTree = new MenuLinkTree($this
    ->createMock('\\Drupal\\Core\\Menu\\MenuTreeStorageInterface'), $this
    ->createMock('\\Drupal\\Core\\Menu\\MenuLinkManagerInterface'), $this
    ->createMock('\\Drupal\\Core\\Routing\\RouteProviderInterface'), $this
    ->createMock('\\Drupal\\Core\\Menu\\MenuActiveTrailInterface'), $this
    ->createMock('\\Drupal\\Core\\Controller\\ControllerResolverInterface'));
  $cache_contexts_manager = $this
    ->getMockBuilder('Drupal\\Core\\Cache\\Context\\CacheContextsManager')
    ->disableOriginalConstructor()
    ->getMock();
  $cache_contexts_manager
    ->method('assertValidTokens')
    ->willReturn(TRUE);
  $container = new ContainerBuilder();
  $container
    ->set('cache_contexts_manager', $cache_contexts_manager);
  \Drupal::setContainer($container);
}