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) + ); + } }