Skip to content

Commit 5932b75

Browse files
authored
Merge pull request #9 from jeffhuys/add-phpunit-12-support
Add phpunit 12 support
2 parents e53b313 + ce6f655 commit 5932b75

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"illuminate/support": "^10.34|^11.0|^12.0",
3131
"illuminate/testing": "^10.34|^11.0|^12.0",
3232
"laravel/nova": "^5.0",
33-
"phpunit/phpunit": "^10.0|^11.0"
33+
"phpunit/phpunit": "^10.0|^11.0|^12.0"
3434
},
3535
"require-dev": {
3636
"friendsofphp/php-cs-fixer": "^3.0",

src/Traits/ActionAssertions.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ public function assertHasValidActions(string $message = ''): self
7373
PHPUnit::assertThat(
7474
$this->component->actions(NovaRequest::createFromGlobals()),
7575
PHPUnit::logicalAnd(
76-
new IsType(IsType::TYPE_ARRAY),
77-
new TraversableContainsOnly(Action::class, false)
76+
function_exists('\PHPUnit\Framework\isArray')
77+
? \PHPUnit\Framework\isArray()
78+
: new IsType(constant('PHPUnit\Framework\Constraint\IsType::TYPE_ARRAY') ?? 'array'),
79+
method_exists(TraversableContainsOnly::class, 'forClassOrInterface')
80+
? TraversableContainsOnly::forClassOrInterface(Action::class)
81+
: new TraversableContainsOnly(Action::class, false)
7882
),
7983
$message
8084
);

src/Traits/FieldAssertions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ public function assertHasValidFields(string $message = ''): self
7676
PHPUnit::assertThat(
7777
$this->component->fields(NovaRequest::createFromGlobals()),
7878
PHPUnit::logicalAnd(
79-
new IsType(IsType::TYPE_ARRAY),
79+
function_exists('\PHPUnit\Framework\isArray')
80+
? \PHPUnit\Framework\isArray()
81+
: new IsType(constant('PHPUnit\Framework\Constraint\IsType::TYPE_ARRAY') ?? 'array'),
8082
new HasValidFields($this->allowPanels())
8183
),
8284
$message

src/Traits/FilterAssertions.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ public function assertHasValidFilters(string $message = ''): self
7171
PHPUnit::assertThat(
7272
$this->component->filters(NovaRequest::createFromGlobals()),
7373
PHPUnit::logicalAnd(
74-
new IsType(IsType::TYPE_ARRAY),
75-
new TraversableContainsOnly(Filter::class, false)
74+
function_exists('\PHPUnit\Framework\isArray')
75+
? \PHPUnit\Framework\isArray()
76+
: new IsType(constant('PHPUnit\Framework\Constraint\IsType::TYPE_ARRAY') ?? 'array'),
77+
method_exists(TraversableContainsOnly::class, 'forClassOrInterface')
78+
? TraversableContainsOnly::forClassOrInterface(Filter::class)
79+
: new TraversableContainsOnly(Filter::class, false)
7680
),
7781
$message
7882
);

0 commit comments

Comments
 (0)