You are here

public function PageAccessTest::setUp in Page Manager 8

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/PageAccessTest.php \Drupal\Tests\page_manager\Unit\PageAccessTest::setUp()

@covers ::__construct

Overrides UnitTestCase::setUp

File

tests/src/Unit/PageAccessTest.php, line 56
Contains \Drupal\Tests\page_manager\Unit\PageAccessTest.

Class

PageAccessTest
Tests access for Page entities.

Namespace

Drupal\Tests\page_manager\Unit

Code

public function setUp() {
  parent::setUp();
  $this->contextHandler = $this
    ->prophesize(ContextHandlerInterface::class);
  $this->entityType = $this
    ->prophesize(EntityTypeInterface::class);
  $module_handler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $module_handler
    ->invokeAll(Argument::cetera())
    ->willReturn([]);
  $this->pageAccess = new PageAccess($this->entityType
    ->reveal(), $this->contextHandler
    ->reveal());
  $this->pageAccess
    ->setModuleHandler($module_handler
    ->reveal());
  $this->cacheContextsManager = $this
    ->prophesize(CacheContextsManager::class);
  $container = new ContainerBuilder();
  $container
    ->set('cache_contexts_manager', $this->cacheContextsManager
    ->reveal());
  \Drupal::setContainer($container);
}