From bbdda2bfc1a890fa0f03cb389a751bfa89eafd99 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 25 Jun 2025 11:21:04 -0400 Subject: [PATCH] wip --- tests/Data/Entries/EntryTest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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); + } }