You are here

public function PanelsStorageTest::testSaveSuccessful in Panels 8.3

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

@covers ::save

File

tests/src/Unit/PanelsStorageTest.php, line 105
Contains \Drupal\Tests\panels\Unit\PanelsStorageTest.

Class

PanelsStorageTest
Tests the PageManagerPanelsStorage service.

Namespace

Drupal\Tests\panels\Unit

Code

public function testSaveSuccessful() {
  $test_config = [
    'my_config' => '123',
  ];
  $this->panelsDisplay
    ->setConfiguration($test_config)
    ->shouldBeCalledTimes(1);
  $this->pageVariant
    ->save()
    ->shouldBeCalledTimes(1);
  $this->storage
    ->load('id_exists')
    ->willReturn($this->pageVariant
    ->reveal());
  $panels_display = $this
    ->prophesize(PanelsDisplayVariant::class);
  $panels_display
    ->getStorageId()
    ->willReturn('id_exists');
  $panels_display
    ->getConfiguration()
    ->willReturn($test_config);
  $panels_storage = new PageManagerPanelsStorage([], '', [], $this->entityTypeManager
    ->reveal());
  $panels_storage
    ->save($panels_display
    ->reveal());
}