Skip to content

Commit

Permalink
Migrate data providers to PHPUnit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed May 7, 2023
1 parent eb714f6 commit cb215f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
17 changes: 5 additions & 12 deletions tests/Graph/AncestorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand Down
17 changes: 5 additions & 12 deletions tests/Graph/DescendantsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand Down

0 comments on commit cb215f6

Please sign in to comment.