From 5f98c3406067b015c2eb5b1942ff4e195d63cb9c Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Sun, 6 Oct 2024 16:38:31 +0200 Subject: [PATCH] Refactoring --- tests/Tree/CollectionTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Tree/CollectionTest.php b/tests/Tree/CollectionTest.php index d858d81..dd19c86 100644 --- a/tests/Tree/CollectionTest.php +++ b/tests/Tree/CollectionTest.php @@ -53,8 +53,8 @@ public function testLoadTreePathRelations(): void $this->assertTrue($user->relationLoaded('ancestorsAndSelf')); $this->assertTrue($user->relationLoaded('parent')); - $this->assertEquals($user->ancestors()->pluck('id')->all(), $user->ancestors->pluck('id')->all()); - $this->assertEquals($user->ancestorsAndSelf()->pluck('id')->all(), $user->ancestorsAndSelf->pluck('id')->all()); + $this->assertEquals($user->ancestors()->orderByDesc('depth')->pluck('id')->all(), $user->ancestors->pluck('id')->all()); + $this->assertEquals($user->ancestorsAndSelf()->orderByDesc('depth')->pluck('id')->all(), $user->ancestorsAndSelf->pluck('id')->all()); $this->assertEquals($user->parent()->first()?->id, $user->parent?->id); } } @@ -72,8 +72,8 @@ public function testLoadTreePathRelationsWithMissingModels(): void $this->assertTrue($user->relationLoaded('ancestorsAndSelf')); $this->assertTrue($user->relationLoaded('parent')); - $this->assertEquals($user->ancestors()->pluck('id')->all(), $user->ancestors->pluck('id')->all()); - $this->assertEquals($user->ancestorsAndSelf()->pluck('id')->all(), $user->ancestorsAndSelf->pluck('id')->all()); + $this->assertEquals($user->ancestors()->orderByDesc('depth')->pluck('id')->all(), $user->ancestors->pluck('id')->all()); + $this->assertEquals($user->ancestorsAndSelf()->orderByDesc('depth')->pluck('id')->all(), $user->ancestorsAndSelf->pluck('id')->all()); $this->assertEquals($user->parent()->first()?->id, $user->parent?->id); } }