Skip to content

Commit

Permalink
Merge pull request #605 from PHPCSStandards/testutils/tests-skipjscss…
Browse files Browse the repository at this point in the history
…onphpcs4-fix-test-compat-with-phpunit-10

SkipJSCSSTestsOnPHPCS4Test: fix compatibility with PHPUnit >= 10
  • Loading branch information
jrfnl authored May 20, 2024
2 parents f6b22f6 + 4ccdd33 commit 11d471a
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 11d471a

Please sign in to comment.