You are here

public function SerializationTest::testItemSerialization in Search API 8

Tests that serialization of items works correctly.

File

tests/src/Kernel/System/SerializationTest.php, line 211

Class

SerializationTest
Tests that various classes can be properly serialized and/or cloned.

Namespace

Drupal\Tests\search_api\Kernel\System

Code

public function testItemSerialization() {
  $item = $this
    ->createTestItem();

  /** @var \Drupal\search_api\Query\ResultSetInterface $serialized */
  $serialized = unserialize(serialize($item));

  // Call serialize() on the restored item to make "equals" work correctly.
  serialize($serialized);
  $this
    ->assertEquals($item, $serialized);
}