You are here

public function PanelizerFieldPanelsStorageTest::testSaveNoEntity in Panelizer 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testSaveNoEntity()
  2. 8.3 tests/src/Unit/PanelizerFieldPanelsStorageTest.php \Drupal\Tests\panelizer\Unit\PanelizerFieldPanelsStorageTest::testSaveNoEntity()

@covers ::save

File

tests/src/Unit/PanelizerFieldPanelsStorageTest.php, line 166

Class

PanelizerFieldPanelsStorageTest
Tests the PanelizerFieldPanelsStorage service.

Namespace

Drupal\Tests\panelizer\Unit

Code

public function testSaveNoEntity() {
  $panels_display = $this
    ->prophesize(PanelsDisplayVariant::class);
  $panels_display
    ->getStorageId()
    ->willReturn('entity_type_id:123:view_mode');
  $this->panelizer
    ->setPanelsDisplay()
    ->shouldNotBeCalled();
  $this->storage
    ->load('123')
    ->willReturn(NULL)
    ->shouldBeCalled();
  $this
    ->expectException('Exception');
  $this
    ->expectExceptionMessage("Couldn't find entity to store Panels display on");
  $this->panelsStorage
    ->save($panels_display
    ->reveal());
}