You are here

public function WebformScheduledTaskSerializationTest::testSerialize in Webform Scheduled Tasks 8.2

Test serializing the entity.

File

tests/src/Kernel/WebformScheduledTaskSerializationTest.php, line 43

Class

WebformScheduledTaskSerializationTest
Test serializing the entity.

Namespace

Drupal\Tests\webform_scheduled_tasks\Kernel

Code

public function testSerialize() {
  Webform::create([
    'id' => 'foo',
  ])
    ->save();
  $scheduled_task = WebformScheduledTask::create([
    'id' => 'foo',
    'result_set_type' => 'all_submissions',
    'task_type' => 'test_task',
    'webform' => 'foo',
  ]);
  $scheduled_task
    ->save();
  $serialized = serialize($scheduled_task);
  $unserialized = unserialize($serialized);
  $this
    ->assertEquals($scheduled_task
    ->id(), $unserialized
    ->id());
}