public function MessageDigestTest::testDigestSerialization in Message Digest 8
Checks that message digest plugins can be correctly serialized.
File
- tests/
src/ Kernel/ MessageDigestTest.php, line 533
Class
- MessageDigestTest
- Kernel tests for Message Digest.
Namespace
Drupal\Tests\message_digest\KernelCode
public function testDigestSerialization() {
foreach ([
'daily',
'weekly',
] as $interval) {
$plugin_id = "message_digest:{$interval}";
$dummy = Message::create([
'template' => 'foo',
]);
/** @var \Drupal\message_digest\Plugin\Notifier\DigestInterface $notifier */
$notifier = $this->notifierManager
->createInstance($plugin_id, [], $dummy);
/** @var \Drupal\message_digest\Plugin\Notifier\DigestInterface $unserialized_notifier */
$unserialized_notifier = unserialize(serialize($notifier));
$this
->assertEquals($plugin_id, $unserialized_notifier
->getPluginId());
}
}