function PermissionAccessCheckTest::setUp

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

Overrides UnitTestCase::setUp

File

core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php, line 36

Class

PermissionAccessCheckTest
@coversDefaultClass \Drupal\user\Access\PermissionAccessCheck @group Routing @group Access

Namespace

Drupal\Tests\user\Unit

Code

protected function setUp() : void {
    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);
    $this->accessCheck = new PermissionAccessCheck();
}

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