diff --git a/tests/Data/Entries/EntryTest.php b/tests/Data/Entries/EntryTest.php index bffe08eef18..583fb05001b 100644 --- a/tests/Data/Entries/EntryTest.php +++ b/tests/Data/Entries/EntryTest.php @@ -2678,4 +2678,31 @@ public function it_clones_internal_collections() $this->assertEquals('A', $entry->getSupplement('bar')); $this->assertEquals('B', $clone->getSupplement('bar')); } + + #[Test] + public function entries_can_be_serialized_after_resolving_values() + { + $entry = EntryFactory::id('entry-id') + ->collection('test') + ->slug('entry-slug') + ->create(); + + $customEntry = CustomEntry::fromEntry($entry); + + $serialized = serialize($customEntry); + $unserialized = unserialize($serialized); + + $this->assertSame('entry-slug', $unserialized->slug); + } +} + +class CustomEntry extends Entry +{ + public static function fromEntry(Entry $entry) + { + return (new static) + ->slug($entry->slug) + ->collection($entry->collection) + ->data($entry->data); + } }