public function PanelizerFieldPanelsStorageTest::testLoad in Panelizer 8.4
Same name and namespace in other branches
- 8.5 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testLoad()
- 8.3 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testLoad()
@covers ::load
File
- tests/
src/ Unit/ PanelizerFieldPanelsStorageTest.php, line 74
Class
- PanelizerFieldPanelsStorageTest
- Tests the PanelizerFieldPanelsStorage service.
Namespace
Drupal\Tests\panelizer\UnitCode
public function testLoad() {
$entity_context = $this
->prophesize(AutomaticContext::class);
$panels_display = $this
->prophesize(PanelsDisplayVariant::class);
$panels_display
->setContexts([
'@panelizer.entity_context:entity' => $entity_context
->reveal(),
])
->shouldBeCalled();
$entity = $this
->prophesize(FieldableEntityInterface::class);
$this->panelizer
->getPanelsDisplay($entity
->reveal(), 'view_mode')
->willReturn($panels_display
->reveal());
$this->storage
->load('123')
->willReturn($entity
->reveal())
->shouldBeCalled();
$this->panelsStorage
->method('getEntityContext')
->with($this
->equalTo('entity_type_id'), $entity
->reveal())
->willReturn($entity_context
->reveal());
$this
->assertSame($panels_display
->reveal(), $this->panelsStorage
->load('entity_type_id:123:view_mode'));
}