Skip to content

Commit 76f6200

Browse files
committed
Adding tests for morphTo eager loading
1 parent 2ae7980 commit 76f6200

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/RelationsTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,15 @@ public function testMorph()
292292
$relations = $user->getRelations();
293293
$this->assertTrue(array_key_exists('photos', $relations));
294294
$this->assertEquals(1, $relations['photos']->count());
295+
296+
$photos = Photo::with('imageable')->get();
297+
$relations = $photos[0]->getRelations();
298+
$this->assertTrue(array_key_exists('imageable', $relations));
299+
$this->assertInstanceOf('User', $relations['imageable']);
300+
301+
$relations = $photos[1]->getRelations();
302+
$this->assertTrue(array_key_exists('imageable', $relations));
303+
$this->assertInstanceOf('Client', $relations['imageable']);
295304
}
296305

297306
public function testEmbedsManySave()

0 commit comments

Comments
 (0)