You are here

public function PanelsStorageTest::testSaveNotPanels in Panels 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/PanelsStorageTest.php \Drupal\Tests\panels\Unit\PanelsStorageTest::testSaveNotPanels()

@covers ::save

File

tests/src/Unit/PanelsStorageTest.php, line 137

Class

PanelsStorageTest
Tests the PageManagerPanelsStorage service.

Namespace

Drupal\Tests\panels\Unit

Code

public function testSaveNotPanels() {
  $this->storage
    ->load('not_a_panel')
    ->willReturn($this->pageVariantNotPanels
    ->reveal());
  $this->panelsDisplay
    ->setConfiguration(Argument::cetera())
    ->shouldNotBeCalled();
  $this->pageVariant
    ->save()
    ->shouldNotBeCalled();
  $panels_display = $this
    ->prophesize(PanelsDisplayVariant::class);
  $panels_display
    ->getStorageId()
    ->willReturn('not_a_panel');
  $panels_display
    ->getConfiguration()
    ->shouldNotBeCalled();
  $panels_storage = new PageManagerPanelsStorage([], '', [], $this->entityTypeManager
    ->reveal());
  $this
    ->expectException('Exception');
  $this
    ->expectExceptionMessage("Page variant doesn't use a Panels display variant");
  $panels_storage
    ->save($panels_display
    ->reveal());
}