public function PanelizerFieldPanelsStorageTest::testSaveFailed in Panelizer 8.3
Same name and namespace in other branches
- 8.5 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testSaveFailed()
- 8.4 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testSaveFailed()
@covers ::save
@expectedException \Exception @expectedExceptionMessage Save failed
File
- tests/
src/ Unit/ PanelizerFieldPanelsStorageTest.php, line 186
Class
- PanelizerFieldPanelsStorageTest
- Tests the PanelizerFieldPanelsStorage service.
Namespace
Drupal\Tests\panelizer\UnitCode
public function testSaveFailed() {
$panels_display = $this
->prophesize(PanelsDisplayVariant::class);
$panels_display
->getStorageId()
->willReturn('entity_type_id:123:view_mode');
$entity = $this
->prophesize(FieldableEntityInterface::class);
$this->panelizer
->setPanelsDisplay($entity
->reveal(), 'view_mode', NULL, $panels_display)
->willThrow(new PanelizerException("Save failed"));
$this->storage
->load('123')
->willReturn($entity
->reveal())
->shouldBeCalled();
$this->panelsStorage
->save($panels_display
->reveal());
}