From c88aa3d74b63c99eeeb5e542fd0534d90bd06374 Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Wed, 27 Feb 2019 10:31:50 +0100 Subject: [PATCH] Add eager loading test --- tests/BelongsToThroughTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/BelongsToThroughTest.php b/tests/BelongsToThroughTest.php index bc6e855..d2e3f01 100644 --- a/tests/BelongsToThroughTest.php +++ b/tests/BelongsToThroughTest.php @@ -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');