File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2678,4 +2678,31 @@ public function it_clones_internal_collections()
26782678 $ this ->assertEquals ('A ' , $ entry ->getSupplement ('bar ' ));
26792679 $ this ->assertEquals ('B ' , $ clone ->getSupplement ('bar ' ));
26802680 }
2681+
2682+ #[Test]
2683+ public function entries_can_be_serialized_after_resolving_values ()
2684+ {
2685+ $ entry = EntryFactory::id ('entry-id ' )
2686+ ->collection ('test ' )
2687+ ->slug ('entry-slug ' )
2688+ ->create ();
2689+
2690+ $ customEntry = CustomEntry::fromEntry ($ entry );
2691+
2692+ $ serialized = serialize ($ customEntry );
2693+ $ unserialized = unserialize ($ serialized );
2694+
2695+ $ this ->assertSame ('entry-slug ' , $ unserialized ->slug );
2696+ }
2697+ }
2698+
2699+ class CustomEntry extends Entry
2700+ {
2701+ public static function fromEntry (Entry $ entry )
2702+ {
2703+ return (new static )
2704+ ->slug ($ entry ->slug )
2705+ ->collection ($ entry ->collection )
2706+ ->data ($ entry ->data );
2707+ }
26812708}
You can’t perform that action at this time.
0 commit comments