function ActiveWorkspaceCheckTest::setUp

Same name in other branches
  1. 9 core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php \Drupal\Tests\workspaces\Unit\ActiveWorkspaceCheckTest::setUp()
  2. 10 core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php \Drupal\Tests\workspaces\Unit\ActiveWorkspaceCheckTest::setUp()
  3. 11.x core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php \Drupal\Tests\workspaces\Unit\ActiveWorkspaceCheckTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php, line 31

Class

ActiveWorkspaceCheckTest
@coversDefaultClass \Drupal\workspaces\Access\ActiveWorkspaceCheck

Namespace

Drupal\Tests\workspaces\Unit

Code

protected function setUp() {
    parent::setUp();
    $this->container = new ContainerBuilder();
    $cache_contexts_manager = $this->prophesize(CacheContextsManager::class);
    $cache_contexts_manager->assertValidTokens()
        ->willReturn(TRUE);
    $cache_contexts_manager->reveal();
    $this->container
        ->set('cache_contexts_manager', $cache_contexts_manager);
    \Drupal::setContainer($this->container);
}

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