5dc896173d924933969a79d6121c4ad1b6eded54
[plcapi.git] / tests / PolyfillTestCase.php
1 <?php
2
3 use PHPUnit\Framework\TestResult;
4 use PHPUnit\Runner\Version as PHPUnit_Version;
5 use Yoast\PHPUnitPolyfills\TestCases\TestCase;
6
7 if (class_exists('PhpXmlRpc_PolyfillTestCase')) {
8     return;
9 }
10
11 if (class_exists(PHPUnit_Version::class) === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) {
12     abstract class PhpXmlRpc_PolyfillTestCase extends TestCase
13     {
14         public function _run($result = null) {
15             return parent::run($result);
16         }
17
18         public static function _fail() {}
19
20         public function run($result = null) {
21             return $this->_run($result);
22         }
23
24         public static function fail($message = '') {
25             static::_fail($message);
26             self::fail($message);
27         }
28     }
29 } else {
30     abstract class PhpXmlRpc_PolyfillTestCase extends TestCase
31     {
32         public function _run(TestResult $result = null) {
33             return parent::run($result);
34         }
35
36         public static function _fail() {}
37
38         public function run(TestResult $result = null): TestResult {
39             return $this->_run($result);
40         }
41
42         public static function fail(string $message = ''): void {
43             static::_fail($message);
44             parent::fail($message);
45         }
46     }
47 }