mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Allow PHPUnit 9 (#3072)
* Allow PHPUnit 9 Had to add a couple of compatibility shims to keep tests the same. * import method_exists()
This commit is contained in:
parent
a1be95dc19
commit
c50faeafee
@ -45,7 +45,7 @@
|
|||||||
"brianium/paratest": "^4.0.0",
|
"brianium/paratest": "^4.0.0",
|
||||||
"phpmyadmin/sql-parser": "5.1.0",
|
"phpmyadmin/sql-parser": "5.1.0",
|
||||||
"phpspec/prophecy": ">=1.9.0",
|
"phpspec/prophecy": ">=1.9.0",
|
||||||
"phpunit/phpunit": "^7.5.16 || ^8.5",
|
"phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0",
|
||||||
"psalm/plugin-phpunit": "^0.9",
|
"psalm/plugin-phpunit": "^0.9",
|
||||||
"slevomat/coding-standard": "^5.0",
|
"slevomat/coding-standard": "^5.0",
|
||||||
"squizlabs/php_codesniffer": "^3.5",
|
"squizlabs/php_codesniffer": "^3.5",
|
||||||
|
@ -6,6 +6,7 @@ use function defined;
|
|||||||
use const DIRECTORY_SEPARATOR;
|
use const DIRECTORY_SEPARATOR;
|
||||||
use function getcwd;
|
use function getcwd;
|
||||||
use function ini_set;
|
use function ini_set;
|
||||||
|
use function method_exists;
|
||||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||||
use Psalm\Config;
|
use Psalm\Config;
|
||||||
use Psalm\Internal\Analyzer\FileAnalyzer;
|
use Psalm\Internal\Analyzer\FileAnalyzer;
|
||||||
@ -153,4 +154,26 @@ class TestCase extends BaseTestCase
|
|||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compatibility alias
|
||||||
|
*/
|
||||||
|
public function expectExceptionMessageRegExp(string $regexp): void
|
||||||
|
{
|
||||||
|
if (method_exists($this, 'expectExceptionMessageMatches')) {
|
||||||
|
$this->expectExceptionMessageMatches($regexp);
|
||||||
|
} else {
|
||||||
|
/** @psalm-suppress UndefinedMethod */
|
||||||
|
parent::expectExceptionMessageRegExp($regexp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function assertRegExp(string $pattern, string $string, string $message = ''): void
|
||||||
|
{
|
||||||
|
if (method_exists(self::class, 'assertMatchesRegularExpression')) {
|
||||||
|
self::assertMatchesRegularExpression($pattern, $string, $message);
|
||||||
|
} else {
|
||||||
|
parent::assertRegExp($pattern, $string, $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user