You are here

protected function PageContextTestBase::setUp in Page Manager 8

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

Overrides UnitTestCase::setUp

File

tests/src/Unit/PageContextTestBase.php, line 45
Contains \Drupal\Tests\page_manager\Unit\PageContextTestBase.

Class

PageContextTestBase
Provides a base class for testing page context classes.

Namespace

Drupal\Tests\page_manager\Unit

Code

protected function setUp() {
  parent::setUp();
  $this->typedDataManager = $this
    ->prophesize(TypedDataManager::class);
  $container = new ContainerBuilder();
  $container
    ->set('string_translation', $this
    ->getStringTranslationStub());
  $container
    ->set('typed_data_manager', $this->typedDataManager
    ->reveal());
  \Drupal::setContainer($container);
  $this->page = $this
    ->prophesize(PageInterface::class);
  $this->event = new PageManagerContextEvent($this->page
    ->reveal());
}