You are here

protected function DefaultMenuLinkTreeManipulatorsTest::setUp in Drupal 8

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php, line 69

Class

DefaultMenuLinkTreeManipulatorsTest
Tests the default menu link tree manipulators.

Namespace

Drupal\Tests\Core\Menu

Code

protected function setUp() {
  parent::setUp();
  $this->accessManager = $this
    ->createMock('\\Drupal\\Core\\Access\\AccessManagerInterface');
  $this->currentUser = $this
    ->createMock('Drupal\\Core\\Session\\AccountInterface');
  $this->currentUser
    ->method('isAuthenticated')
    ->willReturn(TRUE);
  $this->entityTypeManager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $this->defaultMenuTreeManipulators = new DefaultMenuLinkTreeManipulators($this->accessManager, $this->currentUser, $this->entityTypeManager);
  $cache_contexts_manager = $this
    ->prophesize(CacheContextsManager::class);
  $cache_contexts_manager
    ->assertValidTokens()
    ->willReturn(TRUE);
  $cache_contexts_manager
    ->reveal();
  $container = new Container();
  $container
    ->set('cache_contexts_manager', $cache_contexts_manager);
  \Drupal::setContainer($container);
}