Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Jul 8, 2024
1 parent 4bd6087 commit 4822aac
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\OrderItem;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\OrderItemWithNullFK;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\OrderWithFactory;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\Profile;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\Type;
use Yiisoft\ActiveRecord\Tests\Support\Assert;
use Yiisoft\Db\Exception\Exception;
Expand Down Expand Up @@ -1092,21 +1093,21 @@ public function testWithFactoryNonInitiated(): void

public function testSerialization(): void
{
$this->checkFixture($this->db(), 'customer');
$this->checkFixture($this->db(), 'profile');

$customer = new Customer();
$profile = new Profile();

$this->assertStringStartsWith(
'O:54:"Yiisoft\\ActiveRecord\\Tests\\Stubs\\ActiveRecord\\Customer"',
serialize($customer)
$this->assertEquals(
"O:53:\"Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\Profile\":3:{s:56:\"\0Yiisoft\ActiveRecord\AbstractActiveRecord\0oldAttributes\";N;s:50:\"\0Yiisoft\ActiveRecord\AbstractActiveRecord\0related\";a:0:{}s:64:\"\0Yiisoft\ActiveRecord\AbstractActiveRecord\0relationsDependencies\";a:0:{}}",
serialize($profile)
);

$customerQuery = new ActiveQuery(Customer::class);
$customer = $customerQuery->findOne(1);
$profileQuery = new ActiveQuery(Profile::class);
$profile = $profileQuery->findOne(1);

$this->assertStringStartsWith(
'O:54:"Yiisoft\\ActiveRecord\\Tests\\Stubs\\ActiveRecord\\Customer"',
serialize($customer)
$this->assertEquals(
"O:53:\"Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\Profile\":5:{s:56:\"\0Yiisoft\ActiveRecord\AbstractActiveRecord\0oldAttributes\";a:2:{s:2:\"id\";i:1;s:11:\"description\";s:18:\"profile customer 1\";}s:50:\"\0Yiisoft\ActiveRecord\AbstractActiveRecord\0related\";a:0:{}s:64:\"\0Yiisoft\ActiveRecord\AbstractActiveRecord\0relationsDependencies\";a:0:{}s:5:\"\0*\0id\";i:1;s:14:\"\0*\0description\";s:18:\"profile customer 1\";}",
serialize($profile)
);
}
}

0 comments on commit 4822aac

Please sign in to comment.