1 | <?php |
||
15 | // Unify setting expected exception for different phpunit versions |
||
16 | |||
17 | // starting with PHPUnit 7.0 `expectException()` needs parameter type-hint |
||
18 | // it has to be in a separate file to prevent older php version from choking on static parameter type hints |
||
19 | // before PHPUnit 6.0 there was `setExpectedException()` |
||
20 | // inbetween there was `expectException()` without type hint |
||
21 | |||
22 | if (class_exists('PHPUnit\Runner\Version')) { |
||
23 | $version = PHPUnit\Runner\Version::id(); |
||
24 | } else if (class_exists('PHPUnit_Runner_Version')) { |
||
25 | $version = PHPUnit_Runner_Version::id(); |
||
26 | } else { |
||
27 | throw new Exception('Cannot detect PHPUnit version'); |
||
28 | } |
||
29 | |||
30 | if (version_compare($version, '7.0.0', '>=')) { |
||
31 | require dirname(__FILE__) . '/Base/PHPUnit7.php'; |
||
32 | class_alias('Base_PHPUnit7', 'SwaggerGen_TestCase'); |
||
33 | } else if (version_compare($version, '6.0.0', '>=')) { |
||
34 | require dirname(__FILE__) . '/Base/PHPUnit6.php'; |
||
35 | class_alias('Base_PHPUnit6', 'SwaggerGen_TestCase'); |
||
36 | } else { |
||
40 |