function DefaultMenuLinkTreeManipulatorsTest::setUp

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php \Drupal\Tests\Core\Menu\DefaultMenuLinkTreeManipulatorsTest::setUp()
  2. 8.9.x core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php \Drupal\Tests\Core\Menu\DefaultMenuLinkTreeManipulatorsTest::setUp()
  3. 10 core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php \Drupal\Tests\Core\Menu\DefaultMenuLinkTreeManipulatorsTest::setUp()

Overrides UnitTestCase::setUp

File

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

Class

DefaultMenuLinkTreeManipulatorsTest
Tests the default menu link tree manipulators.

Namespace

Drupal\Tests\Core\Menu

Code

protected function setUp() : void {
    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->moduleHandler = $this->createMock(ModuleHandlerInterface::class);
    $this->defaultMenuTreeManipulators = new DefaultMenuLinkTreeManipulators($this->accessManager, $this->currentUser, $this->entityTypeManager, $this->moduleHandler);
    $this->cacheContextManager = $this->prophesize(CacheContextsManager::class);
    $container = new Container();
    $container->set('cache_contexts_manager', $this->cacheContextManager
        ->reveal());
    $container->set('module_handler', $this->moduleHandler);
    \Drupal::setContainer($container);
}

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