You are here

protected function NodeOperationAccessTest::setUp in Drupal 10

File

core/modules/node/tests/src/Unit/NodeOperationAccessTest.php, line 31

Class

NodeOperationAccessTest
Tests node operations.

Namespace

Drupal\Tests\node\Unit

Code

protected function setUp() : void {
  parent::setUp();

  // Cache utility calls container directly.
  $cacheContextsManager = $this
    ->getMockBuilder(CacheContextsManager::class)
    ->disableOriginalConstructor()
    ->getMock();
  $cacheContextsManager
    ->method('assertValidTokens')
    ->willReturn(TRUE);
  $container = new ContainerBuilder();
  $container
    ->set('cache_contexts_manager', $cacheContextsManager);
  \Drupal::setContainer($container);
}