You are here

protected function EntityAccessControlHandlerTest::setUp in Entity API 8

Overrides UnitTestCase::setUp

File

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

Class

EntityAccessControlHandlerTest
@coversDefaultClass \Drupal\entity\EntityAccessControlHandler @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);
}