function NodeOperationAccessTest::setUp

Same name in other branches
  1. 9 core/modules/node/tests/src/Unit/NodeOperationAccessTest.php \Drupal\Tests\node\Unit\NodeOperationAccessTest::setUp()
  2. 10 core/modules/node/tests/src/Unit/NodeOperationAccessTest.php \Drupal\Tests\node\Unit\NodeOperationAccessTest::setUp()

Overrides UnitTestCase::setUp

File

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

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);
}

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