From 07605e9ce84775eccfd73703cf753e68f5c1e9aa Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 6 Feb 2023 01:55:22 -0600 Subject: [PATCH] Tests: master branch uses ParaTest vs PHPUnit --- tests/PhpseclibTestCase.php | 44 ------------------------- tests/make_compatible_with_phpunit7.php | 31 ----------------- tests/make_compatible_with_phpunit9.php | 23 ------------- 3 files changed, 98 deletions(-) delete mode 100644 tests/make_compatible_with_phpunit7.php delete mode 100644 tests/make_compatible_with_phpunit9.php diff --git a/tests/PhpseclibTestCase.php b/tests/PhpseclibTestCase.php index 3418736c..cd68e424 100644 --- a/tests/PhpseclibTestCase.php +++ b/tests/PhpseclibTestCase.php @@ -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); - } } diff --git a/tests/make_compatible_with_phpunit7.php b/tests/make_compatible_with_phpunit7.php deleted file mode 100644 index deb68aca..00000000 --- a/tests/make_compatible_with_phpunit7.php +++ /dev/null @@ -1,31 +0,0 @@ - $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()); - } - } -} diff --git a/tests/make_compatible_with_phpunit9.php b/tests/make_compatible_with_phpunit9.php deleted file mode 100644 index db04795d..00000000 --- a/tests/make_compatible_with_phpunit9.php +++ /dev/null @@ -1,23 +0,0 @@ - $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()); - } - } -}