You are here

public function SerializationTest::testHttpStatusCodeVariantPlugin in Page Manager 8.4

Same name and namespace in other branches
  1. 8 tests/src/Kernel/SerializationTest.php \Drupal\Tests\page_manager\Kernel\SerializationTest::testHttpStatusCodeVariantPlugin()

Test serialization of a block_display variant plugin.

File

tests/src/Kernel/SerializationTest.php, line 230

Class

SerializationTest
Tests the serialization of the entities we provide.

Namespace

Drupal\Tests\page_manager\Kernel

Code

public function testHttpStatusCodeVariantPlugin() {
  $configuration = [
    'status_code' => '404',
  ];

  /* @var \Drupal\page_manager\Plugin\DisplayVariant\HttpStatusCodeDisplayVariant $variant_plugin */
  $variant_plugin = $this->container
    ->get('plugin.manager.display_variant')
    ->createInstance('http_status_code', $configuration);
  $this
    ->assertInstanceOf(HttpStatusCodeDisplayVariant::class, $variant_plugin);

  // Test that a very simple variant successfully serializes.

  /* @var \Drupal\page_manager\Plugin\DisplayVariant\PageBlockDisplayVariant $unserialized */
  $unserialized = $this
    ->assertSerialization($variant_plugin);
  $this
    ->assertEquals($variant_plugin
    ->getConfiguration(), $unserialized
    ->getConfiguration());
}