Skip to content

Commit

Permalink
SkipJSCSSTestsOnPHPCS4Test: fix compatibility with PHPUnit >= 10
Browse files Browse the repository at this point in the history
Looks like the exception thrown for a test skip has been renamed.

Ref: sebastianbergmann/phpunit@7dfe3dd
  • Loading branch information
jrfnl committed May 20, 2024
1 parent f6b22f6 commit 4ccdd33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public function testSkipJsCss()
if (\version_compare(parent::$phpcsVersion, '3.99.99', '>') === true) {
$msg = 'JS and CSS support has been removed in PHPCS 4.';
$exception = 'PHPUnit\Framework\SkippedTestError';
if (\class_exists('PHPUnit_Framework_SkippedTestError')) {

if (\class_exists('PHPUnit\Framework\SkippedWithMessageException')) {
// PHPUnit 10+.
$exception = 'PHPUnit\Framework\SkippedWithMessageException';
} elseif (\class_exists('PHPUnit_Framework_SkippedTestError')) {
// PHPUnit < 6.
$exception = 'PHPUnit_Framework_SkippedTestError';
}
Expand Down
8 changes: 1 addition & 7 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,4 @@ parameters:
- Tests/Utils/GetTokensAsString/GetTokensAsStringTest.php
- Tests/Utils/NamingConventions/IsValidIdentifierNameTest.php

# Ignoring as this is fine.
-
message: '`^Parameter #1 \$exception of method PHPUnit\\Framework\\TestCase::expectException\(\) expects class-string<Throwable>, string given\.$`'
path: Tests/TestUtils/UtilityMethodTestCase/SkipJSCSSTestsOnPHPCS4Test.php
count: 1

# yamllint enable rule:line-length
# yamllint enable rule:line-length

0 comments on commit 4ccdd33

Please sign in to comment.