Skip to content

Commit

Permalink
Add eager loading test
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Feb 27, 2019
1 parent 0ccf22f commit c88aa3d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/BelongsToThroughTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public function testEagerLoading()
$this->assertNull($comments[2]->country);
}

public function testEagerLoadingWithPrefix()
{
$comments = Comment::with('countryWithPrefix')->get();

$this->assertNull($comments[0]->countryWithPrefix);
$this->assertEquals(1, $comments[3]->countryWithPrefix->id);
}

public function testLazyEagerLoading()
{
$comments = Comment::all()->load('country');
Expand Down

0 comments on commit c88aa3d

Please sign in to comment.