You are here

protected function MenuLinkTreeTest::setUp in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/system/src/Tests/Menu/MenuLinkTreeTest.php \Drupal\system\Tests\Menu\MenuLinkTreeTest::setUp()
  2. 8 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.0 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 36
Contains \Drupal\Tests\system\Unit\Menu\MenuLinkTreeTest.

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
    ->getMock('\\Drupal\\Core\\Menu\\MenuTreeStorageInterface'), $this
    ->getMock('\\Drupal\\Core\\Menu\\MenuLinkManagerInterface'), $this
    ->getMock('\\Drupal\\Core\\Routing\\RouteProviderInterface'), $this
    ->getMock('\\Drupal\\Core\\Menu\\MenuActiveTrailInterface'), $this
    ->getMock('\\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);
}