You are here

protected function UncacheableEntityAccessControlHandlerTest::setUp in Entity API 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/UncacheableEntityAccessControlHandlerTest.php, line 32

Class

UncacheableEntityAccessControlHandlerTest
@coversDefaultClass \Drupal\entity\UncacheableEntityAccessControlHandler @group entity

Namespace

Drupal\Tests\entity\Unit

Code

protected function setUp() {
  parent::setUp();
  $module_handler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $module_handler
    ->invokeAll(Argument::any(), Argument::any())
    ->willReturn([]);
  $cache_contexts_manager = $this
    ->prophesize(CacheContextsManager::class);
  $cache_contexts_manager
    ->assertValidTokens(Argument::any())
    ->willReturn(TRUE);
  $container = new ContainerBuilder();
  $container
    ->set('module_handler', $module_handler
    ->reveal());
  $container
    ->set('cache_contexts_manager', $cache_contexts_manager
    ->reveal());
  \Drupal::setContainer($container);
}