You are here

public function PanelsStorageTest::testSaveDoesntExist in Panels 8.4

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

@covers ::save

File

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

Class

PanelsStorageTest
Tests the PageManagerPanelsStorage service.

Namespace

Drupal\Tests\panels\Unit

Code

public function testSaveDoesntExist() {
  $this->panelsDisplay
    ->setConfiguration()
    ->shouldNotBeCalled();
  $this->pageVariant
    ->save()
    ->shouldNotBeCalled();
  $this->storage
    ->load('doesnt_exist')
    ->willReturn(NULL);
  $panels_display = $this
    ->prophesize(PanelsDisplayVariant::class);
  $panels_display
    ->getStorageId()
    ->willReturn('doesnt_exist');
  $panels_display
    ->getConfiguration()
    ->shouldNotBeCalled();
  $panels_storage = new PageManagerPanelsStorage([], '', [], $this->entityTypeManager
    ->reveal());
  $this
    ->expectException('Exception');
  $this
    ->expectExceptionMessage("Couldn't find page variant to store Panels display");
  $panels_storage
    ->save($panels_display
    ->reveal());
}