You are here

protected function LatestRevisionCheckTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 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);
}