From 4bd6087e6214041227c4a8d922dd3e91fa5ab6b9 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Sun, 7 Jul 2024 17:57:25 +0700 Subject: [PATCH] Test serialization --- tests/ActiveRecordTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/ActiveRecordTest.php b/tests/ActiveRecordTest.php index ca9e246df..db2289c08 100644 --- a/tests/ActiveRecordTest.php +++ b/tests/ActiveRecordTest.php @@ -1089,4 +1089,24 @@ public function testWithFactoryNonInitiated(): void $customer = $order->getCustomerWithFactory(); } + + public function testSerialization(): void + { + $this->checkFixture($this->db(), 'customer'); + + $customer = new Customer(); + + $this->assertStringStartsWith( + 'O:54:"Yiisoft\\ActiveRecord\\Tests\\Stubs\\ActiveRecord\\Customer"', + serialize($customer) + ); + + $customerQuery = new ActiveQuery(Customer::class); + $customer = $customerQuery->findOne(1); + + $this->assertStringStartsWith( + 'O:54:"Yiisoft\\ActiveRecord\\Tests\\Stubs\\ActiveRecord\\Customer"', + serialize($customer) + ); + } }