You are here

protected function AccessResultTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Access/AccessResultTest.php \Drupal\Tests\Core\Access\AccessResultTest::setUp()
  2. 9 core/tests/Drupal/Tests/Core/Access/AccessResultTest.php \Drupal\Tests\Core\Access\AccessResultTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Access/AccessResultTest.php, line 35
Contains \Drupal\Tests\Core\Access\AccessResultTest.

Class

AccessResultTest
@coversDefaultClass \Drupal\Core\Access\AccessResult @group Access

Namespace

Drupal\Tests\Core\Access

Code

protected function setUp() : void {
  parent::setUp();
  $this->cacheContextsManager = $this
    ->getMockBuilder('Drupal\\Core\\Cache\\Context\\CacheContextsManager')
    ->disableOriginalConstructor()
    ->getMock();
  $this->cacheContextsManager
    ->method('assertValidTokens')
    ->willReturn(TRUE);
  $container = new ContainerBuilder();
  $container
    ->set('cache_contexts_manager', $this->cacheContextsManager);
  \Drupal::setContainer($container);
}