1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/17176] Remove no longer needed backward compatible phpunit code

PHPBB3-17176
This commit is contained in:
Marc Alexander
2023-09-07 20:49:59 +02:00
parent 5d6218dcba
commit 4078ed7e20
15 changed files with 27 additions and 181 deletions

View File

@@ -29,8 +29,6 @@ abstract class phpbb_database_test_case extends TestCase
protected static $install_schema_file;
protected static $phpunit_version;
/**
* @var \Doctrine\DBAL\Connection[]
*/
@@ -40,9 +38,7 @@ abstract class phpbb_database_test_case extends TestCase
{
parent::__construct($name, $data, $dataName);
self::$phpunit_version = PHPUnit\Runner\Version::id();
$backupStaticAttributesBlacklist = [
$this->backupStaticAttributesExcludeList += [
'SebastianBergmann\CodeCoverage\CodeCoverage' => ['instance'],
'SebastianBergmann\CodeCoverage\Filter' => ['instance'],
'SebastianBergmann\CodeCoverage\Util' => ['ignoredLines', 'templateMethods'],
@@ -53,15 +49,6 @@ abstract class phpbb_database_test_case extends TestCase
'phpbb_database_test_case' => ['already_connected'],
];
if (version_compare(self::$phpunit_version, '9.0', '>='))
{
$this->backupStaticAttributesExcludeList += $backupStaticAttributesBlacklist;
}
else
{
$this->backupStaticAttributesBlacklist += $backupStaticAttributesBlacklist;
}
$this->db_connections = [];
$this->db_connections_doctrine = [];
}
@@ -411,56 +398,4 @@ abstract class phpbb_database_test_case extends TestCase
return $core_tables;
}
/**
* PHPUnit deprecates several methods and properties in its recent versions
* Provide BC layer to be able to test in multiple environment settings
*/
public function expectException(string $exception): void
{
if (version_compare(self::$phpunit_version, '9.0', '>='))
{
switch ($exception) {
case PHPUnit\Framework\Error\Deprecated::class:
parent::expectDeprecation();
break;
case PHPUnit\Framework\Error\Error::class:
parent::expectError();
break;
case PHPUnit\Framework\Error\Notice::class:
parent::expectNotice();
break;
case PHPUnit\Framework\Error\Warning::class:
parent::expectWarning();
break;
default:
parent::expectException($exception);
break;
}
}
else
{
parent::expectException($exception);
}
}
/**
* PHPUnit deprecates several methods and properties in its recent versions
* Provide BC layer to be able to test in multiple environment settings
*/
public static function assertFileNotExists(string $filename, string $message = ''): void
{
if (version_compare(self::$phpunit_version, '9.0', '>='))
{
parent::assertFileDoesNotExist($filename, $message);
}
else
{
parent::assertFileNotExists($filename, $message);
}
}
}