Skip to content

Commit

Permalink
Prepare for Collection::load() fix
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Sep 10, 2024
1 parent 041e1d0 commit 0d237ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/Concatenation/LaravelAdjacencyList/AncestorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Concatenation\LaravelAdjacencyList;

use Illuminate\Database\Eloquent\Relations\Relation;
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
use Tests\Concatenation\LaravelAdjacencyList\Models\User;

Expand Down Expand Up @@ -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());
Expand Down
3 changes: 2 additions & 1 deletion tests/Concatenation/LaravelAdjacencyList/BloodlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Concatenation\LaravelAdjacencyList;

use Illuminate\Database\Eloquent\Relations\Relation;
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
use Tests\Concatenation\LaravelAdjacencyList\Models\User;

Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 0d237ac

Please sign in to comment.