From 0d237ac6d2680144d64918eaf355f226e26136dd Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Tue, 10 Sep 2024 16:47:53 +0200 Subject: [PATCH] Prepare for Collection::load() fix --- tests/Concatenation/LaravelAdjacencyList/AncestorsTest.php | 3 ++- tests/Concatenation/LaravelAdjacencyList/BloodlineTest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Concatenation/LaravelAdjacencyList/AncestorsTest.php b/tests/Concatenation/LaravelAdjacencyList/AncestorsTest.php index f5d0c1c..960b710 100644 --- a/tests/Concatenation/LaravelAdjacencyList/AncestorsTest.php +++ b/tests/Concatenation/LaravelAdjacencyList/AncestorsTest.php @@ -2,6 +2,7 @@ namespace Tests\Concatenation\LaravelAdjacencyList; +use Illuminate\Database\Eloquent\Relations\Relation; use Staudenmeir\EloquentHasManyDeep\HasManyDeep; use Tests\Concatenation\LaravelAdjacencyList\Models\User; @@ -65,7 +66,7 @@ public function testEagerLoadingWithHasOneDeep() public function testLazyEagerLoading() { $users = User::all()->load([ - 'ancestorPosts' => fn (HasManyDeep $query) => $query->orderBy('id'), + 'ancestorPosts' => fn (Relation $query) => $query->getQuery()->orderBy('id'), ]); $this->assertEquals([], $users[0]->ancestorPosts->pluck('id')->all()); diff --git a/tests/Concatenation/LaravelAdjacencyList/BloodlineTest.php b/tests/Concatenation/LaravelAdjacencyList/BloodlineTest.php index c4a1469..939eb3c 100644 --- a/tests/Concatenation/LaravelAdjacencyList/BloodlineTest.php +++ b/tests/Concatenation/LaravelAdjacencyList/BloodlineTest.php @@ -2,6 +2,7 @@ namespace Tests\Concatenation\LaravelAdjacencyList; +use Illuminate\Database\Eloquent\Relations\Relation; use Staudenmeir\EloquentHasManyDeep\HasManyDeep; use Tests\Concatenation\LaravelAdjacencyList\Models\User; @@ -35,7 +36,7 @@ public function testEagerLoading() public function testLazyEagerLoading() { $users = User::all()->load([ - 'bloodlinePosts' => fn (HasManyDeep $query) => $query->orderBy('id'), + 'bloodlinePosts' => fn (Relation $query) => $query->getQuery()->orderBy('id'), ]); $this->assertEquals([10, 20, 30, 40, 50, 60, 70, 80], $users[0]->bloodlinePosts->pluck('id')->all());