mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Merge pull request #7435 from orklah/old-phpunit
drop phpunit compatibility aliases
This commit is contained in:
commit
5c4be6bc21
@ -159,7 +159,7 @@ class PluginListTest extends TestCase
|
||||
{
|
||||
$plugin_list = new PluginList($this->config_file->reveal(), $this->composer_lock->reveal());
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessageRegExp('/unknown plugin/i');
|
||||
$this->expectExceptionMessageMatches('/unknown plugin/i');
|
||||
$plugin_list->resolvePluginClass('vendor/package');
|
||||
}
|
||||
|
||||
|
@ -1156,7 +1156,7 @@ class PluginTest extends TestCase
|
||||
$this->project_analyzer->trackTaintedInputs();
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
$this->expectExceptionMessageRegExp('/TaintedHtml/');
|
||||
$this->expectExceptionMessageMatches('/TaintedHtml/');
|
||||
|
||||
$this->analyzeFile($file_path, new Context());
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ class DocumentationTest extends TestCase
|
||||
}
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
|
||||
$codebase = $this->project_analyzer->getCodebase();
|
||||
$codebase->config->visitPreloadedStubFiles($codebase);
|
||||
|
@ -90,7 +90,7 @@ class ErrorAfterUpdateTest extends TestCase
|
||||
}
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
|
||||
$codebase->reloadFiles($this->project_analyzer, array_keys($end_files));
|
||||
|
||||
|
@ -88,7 +88,7 @@ class IncludeTest extends TestCase
|
||||
$config->skip_checks_on_unresolvable_includes = false;
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
|
||||
$codebase->scanFiles();
|
||||
|
||||
|
@ -150,7 +150,7 @@ class PsalmPluginTest extends TestCase
|
||||
$help_command = new CommandTester($this->app->find('help'));
|
||||
$help_command->execute(['command_name' => $command]);
|
||||
$output = $help_command->getDisplay();
|
||||
$this->assertRegExp('/Usage:.*$\s+' . preg_quote($command, '/') . '\b/m', $output);
|
||||
$this->assertMatchesRegularExpression('/Usage:.*$\s+' . preg_quote($command, '/') . '\b/m', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ class TaintTest extends TestCase
|
||||
}
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
|
||||
$file_path = self::$src_dir_path . 'somefile.php';
|
||||
|
||||
|
@ -24,7 +24,6 @@ use function defined;
|
||||
use function getcwd;
|
||||
use function ini_set;
|
||||
use function is_string;
|
||||
use function method_exists;
|
||||
|
||||
use const ARRAY_FILTER_USE_KEY;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
@ -153,28 +152,6 @@ class TestCase extends BaseTestCase
|
||||
return $this->getName($withDataSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
public static function assertArrayKeysAreStrings(array $array, string $message = ''): void
|
||||
{
|
||||
$validKeys = array_filter($array, 'is_string', ARRAY_FILTER_USE_KEY);
|
||||
|
@ -7,7 +7,6 @@ use Psalm\Context;
|
||||
use Psalm\Exception\CodeException;
|
||||
|
||||
use function is_int;
|
||||
use function method_exists;
|
||||
use function preg_quote;
|
||||
use function str_replace;
|
||||
use function strpos;
|
||||
@ -81,11 +80,7 @@ trait InvalidCodeAnalysisTestTrait
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
|
||||
if (method_exists($this, 'expectExceptionMessageMatches')) {
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
} else {
|
||||
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
}
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
|
||||
$codebase = $this->project_analyzer->getCodebase();
|
||||
$codebase->config->visitPreloadedStubFiles($codebase);
|
||||
|
@ -90,7 +90,7 @@ class UnusedCodeTest extends TestCase
|
||||
}
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
|
||||
$file_path = self::$src_dir_path . 'somefile.php';
|
||||
|
||||
|
@ -82,7 +82,7 @@ class UnusedVariableTest extends TestCase
|
||||
}
|
||||
|
||||
$this->expectException(CodeException::class);
|
||||
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
$this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/');
|
||||
|
||||
$file_path = self::$src_dir_path . 'somefile.php';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user