Commit 76f62009 authored by Jens Segers's avatar Jens Segers

Adding tests for morphTo eager loading

parent 2ae7980f
...@@ -292,6 +292,15 @@ class RelationsTest extends TestCase { ...@@ -292,6 +292,15 @@ class RelationsTest extends TestCase {
$relations = $user->getRelations(); $relations = $user->getRelations();
$this->assertTrue(array_key_exists('photos', $relations)); $this->assertTrue(array_key_exists('photos', $relations));
$this->assertEquals(1, $relations['photos']->count()); $this->assertEquals(1, $relations['photos']->count());
$photos = Photo::with('imageable')->get();
$relations = $photos[0]->getRelations();
$this->assertTrue(array_key_exists('imageable', $relations));
$this->assertInstanceOf('User', $relations['imageable']);
$relations = $photos[1]->getRelations();
$this->assertTrue(array_key_exists('imageable', $relations));
$this->assertInstanceOf('Client', $relations['imageable']);
} }
public function testEmbedsManySave() public function testEmbedsManySave()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment