From cb215f624f6555a95ed36c8e9b67ef0d70fd3fde Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Sun, 7 May 2023 11:56:01 +0200 Subject: [PATCH] Migrate data providers to PHPUnit 10 --- tests/Graph/AncestorsTest.php | 17 +++++------------ tests/Graph/DescendantsTest.php | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/tests/Graph/AncestorsTest.php b/tests/Graph/AncestorsTest.php index b20b94c..da93084 100644 --- a/tests/Graph/AncestorsTest.php +++ b/tests/Graph/AncestorsTest.php @@ -2,6 +2,7 @@ namespace Staudenmeir\LaravelAdjacencyList\Tests\Graph; +use PHPUnit\Framework\Attributes\DataProvider; use Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\Graph\Ancestors; use Staudenmeir\LaravelAdjacencyList\Tests\Graph\Models\Node; use Staudenmeir\LaravelAdjacencyList\Tests\Graph\Models\NodeWithCycleDetection; @@ -30,9 +31,7 @@ public function testLazyLoading() ); } - /** - * @dataProvider cycleDetectionClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionClassProvider')] public function testLazyLoadingWithCycleDetection(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) { @@ -47,9 +46,7 @@ public function testLazyLoadingWithCycleDetection(string $class, array $exclusio $this->assertEquals([-1, -2, -3], $ancestors->pluck('depth')->all()); } - /** - * @dataProvider cycleDetectionAndStartClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionAndStartClassProvider')] public function testLazyLoadingWithCycleDetectionAndStart(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) { @@ -139,9 +136,7 @@ public function testEagerLoading() ); } - /** - * @dataProvider cycleDetectionClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionClassProvider')] public function testEagerLoadingWithCycleDetection(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) { @@ -158,9 +153,7 @@ public function testEagerLoadingWithCycleDetection(string $class, array $exclusi $this->assertEquals([-1, -2, -3], $nodes[0]->ancestors->pluck('depth')->all()); } - /** - * @dataProvider cycleDetectionAndStartClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionAndStartClassProvider')] public function testEagerLoadingWithCycleDetectionAndStart(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) { diff --git a/tests/Graph/DescendantsTest.php b/tests/Graph/DescendantsTest.php index 122a508..ccc6d76 100644 --- a/tests/Graph/DescendantsTest.php +++ b/tests/Graph/DescendantsTest.php @@ -2,6 +2,7 @@ namespace Staudenmeir\LaravelAdjacencyList\Tests\Graph; +use PHPUnit\Framework\Attributes\DataProvider; use Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\Graph\Descendants; use Staudenmeir\LaravelAdjacencyList\Tests\Graph\Models\Node; use Staudenmeir\LaravelAdjacencyList\Tests\Graph\Models\NodeWithCycleDetection; @@ -30,9 +31,7 @@ public function testLazyLoading() ); } - /** - * @dataProvider cycleDetectionClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionClassProvider')] public function testLazyLoadingWithCycleDetection(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) { @@ -47,9 +46,7 @@ public function testLazyLoadingWithCycleDetection(string $class, array $exclusio $this->assertEquals([1, 2, 3], $descendants->pluck('depth')->all()); } - /** - * @dataProvider cycleDetectionAndStartClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionAndStartClassProvider')] public function testLazyLoadingWithCycleDetectionAndStart(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) { @@ -147,9 +144,7 @@ public function testEagerLoading() ); } - /** - * @dataProvider cycleDetectionClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionClassProvider')] public function testEagerLoadingWithCycleDetection(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) { @@ -166,9 +161,7 @@ public function testEagerLoadingWithCycleDetection(string $class, array $exclusi $this->assertEquals([1, 2, 3], $nodes[0]->descendants->pluck('depth')->all()); } - /** - * @dataProvider cycleDetectionAndStartClassProvider - */ + #[DataProvider(methodName: 'cycleDetectionAndStartClassProvider')] public function testEagerLoadingWithCycleDetectionAndStart(string $class, array $exclusions) { if (in_array($this->database, $exclusions)) {