function LatestRevisionCheckTest::setUp

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

Overrides UnitTestCase::setUp

File

core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php, line 30

Class

LatestRevisionCheckTest
@coversDefaultClass \Drupal\content_moderation\Access\LatestRevisionCheck @group content_moderation

Namespace

Drupal\Tests\content_moderation\Unit

Code

protected function setUp() {
    parent::setUp();
    // Initialize Drupal container since the cache context manager is needed.
    $contexts_manager = $this->prophesize(CacheContextsManager::class);
    $contexts_manager->assertValidTokens(Argument::any())
        ->willReturn(TRUE);
    $builder = new ContainerBuilder();
    $builder->set('cache_contexts_manager', $contexts_manager->reveal());
    \Drupal::setContainer($builder);
}

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