function MenuLinkTreeTest::setUp

Same name in this branch
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php \Drupal\KernelTests\Core\Menu\MenuLinkTreeTest::setUp()
Same name in other branches
  1. 9 core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php \Drupal\Tests\system\Unit\Menu\MenuLinkTreeTest::setUp()
  2. 9 core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php \Drupal\KernelTests\Core\Menu\MenuLinkTreeTest::setUp()
  3. 10 core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php \Drupal\Tests\system\Unit\Menu\MenuLinkTreeTest::setUp()
  4. 10 core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php \Drupal\KernelTests\Core\Menu\MenuLinkTreeTest::setUp()
  5. 11.x core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php \Drupal\Tests\system\Unit\Menu\MenuLinkTreeTest::setUp()
  6. 11.x core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php \Drupal\KernelTests\Core\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() {
    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);
}

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