Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into relations-via-array
Browse files Browse the repository at this point in the history
# Conflicts:
#	tests/ActiveRecordTest.php
  • Loading branch information
Tigrov committed Jul 12, 2024
2 parents 025674f + cbd3f16 commit 34f465b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\OrderItemWithNullFK;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\OrderWithFactory;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\Promotion;
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,6 +1093,26 @@ public function testWithFactoryNonInitiated(): void
$customer = $order->getCustomerWithFactory();
}

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

$profile = new Profile();

$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)
);

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

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

public function testRelationViaJson()
{
if (in_array($this->db()->getDriverName(), ['oci', 'sqlsrv'], true)) {
Expand Down

0 comments on commit 34f465b

Please sign in to comment.