public function PanelizerDefaultPanelsStorageTest::testLoadWithContextValue in Panelizer 8.3
Same name and namespace in other branches
- 8.5 tests/src/Unit/PanelizerDefaultPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerDefaultPanelsStorageTest::testLoadWithContextValue()
- 8.4 tests/src/Unit/PanelizerDefaultPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerDefaultPanelsStorageTest::testLoadWithContextValue()
@covers ::load
File
- tests/
src/ Unit/ PanelizerDefaultPanelsStorageTest.php, line 101
Class
- PanelizerDefaultPanelsStorageTest
- Tests the PanelizerDefaultPanelsStorage service.
Namespace
Drupal\Tests\panelizer\UnitCode
public function testLoadWithContextValue() {
$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([]);
$entity = $this
->prophesize(EntityInterface::class);
$entity
->bundle()
->willReturn("bundle");
$this->storage
->load('123')
->willReturn($entity
->reveal())
->shouldBeCalled();
$this->panelsStorage
->method('getEntityContext')
->with($this
->equalTo('entity_type_id'), $entity
->reveal())
->willReturn([
'@panelizer.entity_context:entity' => $entity_context
->reveal(),
]);
$this
->assertSame($panels_display
->reveal(), $this->panelsStorage
->load('*entity_type_id:123:view_mode:default'));
}