You are here

public function PanelizerDefaultPanelsStorageTest::testLoadEmptyContext in Panelizer 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/Unit/PanelizerDefaultPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerDefaultPanelsStorageTest::testLoadEmptyContext()
  2. 8.4 tests/src/Unit/PanelizerDefaultPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerDefaultPanelsStorageTest::testLoadEmptyContext()

@covers ::load

File

tests/src/Unit/PanelizerDefaultPanelsStorageTest.php, line 74

Class

PanelizerDefaultPanelsStorageTest
Tests the PanelizerDefaultPanelsStorage service.

Namespace

Drupal\Tests\panelizer\Unit

Code

public function testLoadEmptyContext() {
  $entity_context = $this
    ->prophesize(Context::class);
  $panels_display = $this
    ->prophesize(PanelsDisplayVariant::class);
  $panels_display
    ->setContexts([
    '@panelizer.entity_context:entity' => $entity_context
      ->reveal(),
  ])
    ->shouldBeCalled();
  $this->panelizer
    ->getDefaultPanelsDisplay('default', 'entity_type_id', 'bundle', 'view_mode', NULL)
    ->willReturn($panels_display
    ->reveal());
  $this->panelizer
    ->getDisplayStaticContexts('default', 'entity_type_id', 'bundle', 'view_mode')
    ->willReturn([]);
  $this->panelsStorage
    ->method('getEntityContext')
    ->with($this
    ->equalTo('entity_type_id'), $this
    ->isNull())
    ->willReturn([
    '@panelizer.entity_context:entity' => $entity_context
      ->reveal(),
  ]);
  $this
    ->assertSame($panels_display
    ->reveal(), $this->panelsStorage
    ->load('entity_type_id:bundle:view_mode:default'));
}