Skip to content

Commit ed5a9db

Browse files
Add tests
1 parent 6403bd8 commit ed5a9db

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/EmbeddedRelationsTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use MongoDB\Laravel\Tests\Models\User;
2020

2121
use function array_merge;
22+
use function PHPUnit\Framework\assertIsString;
2223

2324
class EmbeddedRelationsTest extends TestCase
2425
{
@@ -945,4 +946,13 @@ public function testGetQueueableRelationsEmbedsOne()
945946
$this->assertEquals(['father'], $user->getQueueableRelations());
946947
$this->assertEquals([], $user->father->getQueueableRelations());
947948
}
949+
950+
public function testEmbedManySerialization()
951+
{
952+
$user = User::create(['name' => 'John Doe']);
953+
$user->addresses()->save(new Address(['city' => 'New York']));
954+
955+
$results = $user->toArray();
956+
assertIsString($results['addresses'][0]['_id']);
957+
}
948958
}

0 commit comments

Comments
 (0)