Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 0593935

Browse files
authored
Add PHPUnit 10 support (#20)
1 parent 97fc9ca commit 0593935

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"require": {
1313
"php": "^5.5 || ^7.0 || ^8.0",
14-
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.0 || ^9.0"
14+
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.0 || ^9.0 || ^10.0"
1515
},
1616
"require-dev": {
1717
"friendsofphp/php-cs-fixer": "^2",

phpunit.xml.dist

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="./vendor/autoload.php">
3-
<filter>
4-
<whitelist>
5-
<directory>src</directory>
6-
</whitelist>
7-
</filter>
2+
<phpunit xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
3+
xsi:noNamespaceSchemaLocation='./vendor/phpunit/phpunit/phpunit.xsd'
4+
bootstrap="./vendor/autoload.php"
5+
cacheResult="false"
6+
>
7+
<coverage>
8+
<include>
9+
<directory>./src</directory>
10+
</include>
11+
</coverage>
812
<testsuites>
913
<testsuite name="Default">
1014
<directory>tests</directory>

src/PolyfillTrait.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ trait PolyfillTrait
1616
{
1717
use PolyfillTrait6;
1818
}
19-
} else {
19+
} elseif (version_compare(\PHPUnit\Runner\Version::id(), '10.0.0') < 0) {
2020
trait PolyfillTrait
2121
{
2222
use PolyfillTrait7;
2323
}
24+
} else {
25+
trait PolyfillTrait
26+
{
27+
}
2428
}

src/aliases.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@
99
* with this source code in the file LICENSE.
1010
*/
1111

12-
if (!class_exists('PHPUnit\Framework\Error\Warning')) {
13-
class_alias('PHPUnit_Framework_Error_Warning', 'PHPUnit\Framework\Error\Warning');
14-
}
15-
16-
if (!class_exists('PHPUnit\Framework\ExpectationFailedException')) {
17-
class_alias('PHPUnit_Framework_ExpectationFailedException', 'PHPUnit\Framework\ExpectationFailedException');
18-
}
19-
20-
if (!class_exists('PHPUnit\Framework\TestCase')) {
21-
class_alias('PHPUnit_Framework_TestCase', 'PHPUnit\Framework\TestCase');
22-
}
23-
24-
if (!class_exists('PHPUnit\Runner\Version')) {
25-
class_alias('PHPUnit_Runner_Version', 'PHPUnit\Runner\Version');
12+
foreach ([
13+
'PHPUnit_Framework_Error_Warning' => 'PHPUnit\Framework\Error\Warning',
14+
'PHPUnit_Framework_ExpectationFailedException' => 'PHPUnit\Framework\ExpectationFailedException',
15+
'PHPUnit_Framework_TestCase' => 'PHPUnit\Framework\TestCase',
16+
'PHPUnit_Runner_Version' => 'PHPUnit\Runner\Version',
17+
] as $old => $new) {
18+
if (!class_exists($new) && class_exists($old)) {
19+
class_alias($old, $new);
20+
}
2621
}

0 commit comments

Comments
 (0)