You are here

public function PageVariantTest::testGetContextsAfterReset in Page Manager 8

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

@covers ::getContexts @covers ::removeStaticContext

File

tests/src/Unit/PageVariantTest.php, line 101
Contains \Drupal\Tests\page_manager\Unit\PageVariantTest.

Class

PageVariantTest
@coversDefaultClass \Drupal\page_manager\Entity\PageVariant

Namespace

Drupal\Tests\page_manager\Unit

Code

public function testGetContextsAfterReset() {
  $this->contextMapper
    ->getContextValues([])
    ->willReturn([])
    ->shouldBeCalledTimes(2);
  $this->page
    ->getContexts()
    ->willReturn([])
    ->shouldBeCalledTimes(2);
  $expected = [];
  $contexts = $this->pageVariant
    ->getContexts();
  $this
    ->assertSame($expected, $contexts);
  $this->pageVariant
    ->removeStaticContext('anything');
  $contexts = $this->pageVariant
    ->getContexts();
  $this
    ->assertSame($expected, $contexts);
}