mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 19:40:28 +00:00
Tests: master branch uses ParaTest vs PHPUnit
This commit is contained in:
parent
ca2c9588ea
commit
07605e9ce8
@ -95,48 +95,4 @@ abstract class PhpseclibTestCase extends TestCase
|
||||
$method->setAccessible(true);
|
||||
return $method->invokeArgs($obj, $params);
|
||||
}
|
||||
|
||||
// assertIsArray was not introduced until PHPUnit 8
|
||||
public static function assertIsArray($actual, string $message = ''): void
|
||||
{
|
||||
parent::assertInternalType('array', $actual, $message);
|
||||
}
|
||||
|
||||
// assertIsString was not introduced until PHPUnit 8
|
||||
public static function assertIsString($actual, string $message = ''): void
|
||||
{
|
||||
parent::assertInternalType('string', $actual, $message);
|
||||
}
|
||||
|
||||
// assertIsResource was not introduced until PHPUnit 8
|
||||
public static function assertIsResource($actual, string $message = ''): void
|
||||
{
|
||||
parent::assertInternalType('resource', $actual, $message);
|
||||
}
|
||||
|
||||
// assertIsObject was not introduced until PHPUnit 8
|
||||
public static function assertIsObject($actual, string $message = ''): void
|
||||
{
|
||||
parent::assertInternalType('object', $actual, $message);
|
||||
}
|
||||
|
||||
// assertContains is deprecated for strings in PHPUnit 8
|
||||
public static function assertStringContainsString(string $needle, string $haystack, string $message = ''): void
|
||||
{
|
||||
parent::assertContains($needle, $haystack, $message);
|
||||
}
|
||||
|
||||
// assertNotContains is deprecated for strings in PHPUnit 8
|
||||
public static function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void
|
||||
{
|
||||
parent::assertNotContains($needle, $haystack, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* assertRegExp() was deprecated in favor of assertMatchesRegularExpression().
|
||||
*/
|
||||
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void
|
||||
{
|
||||
parent::assertRegExp($pattern, $string, $message);
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
/** @var iterable<SplFileInfo> $files */
|
||||
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__));
|
||||
foreach ($files as $file) {
|
||||
if ($file->getExtension() === 'php' && $file->getPathname() !== __FILE__) {
|
||||
$fileContents = file_get_contents($file->getPathname());
|
||||
if ($fileContents === false) {
|
||||
throw new \RuntimeException('file_get_contents() failed: ' . $file->getPathname());
|
||||
}
|
||||
$patternToReplacementMap = [
|
||||
'~ function setUpBeforeClass\(\)~' => ' function setUpBeforeClass(): void',
|
||||
'~ function setUp\(\)~' => ' function setUp(): void',
|
||||
'~ function tearDown\(\)~' => ' function tearDown(): void',
|
||||
'~ function assertIsArray\(\$actual, \$message = \'\'\)~' => ' function _assertIsArray($actual, string $message = \'\')',
|
||||
'~ function assertIsResource\(\$actual, \$message = \'\'\)~' => ' function _assertIsResource($actual, string $message = \'\')',
|
||||
'~ function assertIsObject\(\$actual, \$message = \'\'\)~' => ' function _assertIsObject($actual, string $message = \'\')',
|
||||
'~ function assertIsString\(\$actual, \$message = \'\'\)~' => ' function _assertIsString($actual, string $message = \'\')',
|
||||
'~ function assertStringContainsString\(\$needle, \$haystack, \$message = \'\'\)~' => ' function _assertStringContainsString(string $needle, string $haystack, string $message = \'\')',
|
||||
'~ function assertStringNotContainsString\(\$needle, \$haystack, \$message = \'\'\)~' => ' function _assertStringNotContainsString(string $needle, string $haystack, string $message = \'\')'
|
||||
];
|
||||
$updatedFileContents = preg_replace(
|
||||
array_keys($patternToReplacementMap),
|
||||
array_values($patternToReplacementMap),
|
||||
$fileContents
|
||||
);
|
||||
if (file_put_contents($file->getPathname(), $updatedFileContents) === false) {
|
||||
throw new \RuntimeException('file_put_contents() failed: ' . $file->getPathname());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
/** @var iterable<SplFileInfo> $files */
|
||||
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__));
|
||||
foreach ($files as $file) {
|
||||
if ($file->getExtension() === 'php' && $file->getPathname() !== __FILE__) {
|
||||
$fileContents = file_get_contents($file->getPathname());
|
||||
if ($fileContents === false) {
|
||||
throw new \RuntimeException('file_get_contents() failed: ' . $file->getPathname());
|
||||
}
|
||||
$patternToReplacementMap = [
|
||||
'~ function assertMatchesRegularExpression\(\$pattern, \$string, \$message = \'\'\)~' => ' function _assertMatchesRegularExpression(string $pattern, string $string, string $message = \'\')',
|
||||
];
|
||||
$updatedFileContents = preg_replace(
|
||||
array_keys($patternToReplacementMap),
|
||||
array_values($patternToReplacementMap),
|
||||
$fileContents
|
||||
);
|
||||
if (file_put_contents($file->getPathname(), $updatedFileContents) === false) {
|
||||
throw new \RuntimeException('file_put_contents() failed: ' . $file->getPathname());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user