You are here

protected function LatestRevisionCheckTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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()

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() : void {
  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);
}