|
14 | 14 |
|
15 | 15 | error_reporting(-1);
|
16 | 16 |
|
17 |
| -$getEnvVar = function ($name, $default = false) { |
| 17 | +global $argv, $argc; |
| 18 | +$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array(); |
| 19 | +$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0; |
| 20 | +$getEnvVar = function ($name, $default = false) use ($argv) { |
18 | 21 | if (false !== $value = getenv($name)) {
|
19 | 22 | return $value;
|
20 | 23 | }
|
21 | 24 |
|
22 | 25 | static $phpunitConfig = null;
|
23 | 26 | if (null === $phpunitConfig) {
|
| 27 | + $opt = min(array_search('-c', $opts = array_reverse($argv), true) ?: INF, array_search('--configuration', $opts, true) ?: INF); |
24 | 28 | $phpunitConfigFilename = null;
|
25 |
| - if (file_exists('phpunit.xml')) { |
| 29 | + if (INF !== $opt && isset($opts[$opt - 1])) { |
| 30 | + $phpunitConfigFilename = $opts[$opt - 1]; |
| 31 | + } elseif (file_exists('phpunit.xml')) { |
26 | 32 | $phpunitConfigFilename = 'phpunit.xml';
|
27 | 33 | } elseif (file_exists('phpunit.xml.dist')) {
|
28 | 34 | $phpunitConfigFilename = 'phpunit.xml.dist';
|
@@ -185,10 +191,6 @@ class SymfonyBlacklistPhpunit {}
|
185 | 191 | chdir($oldPwd);
|
186 | 192 | }
|
187 | 193 |
|
188 |
| -global $argv, $argc; |
189 |
| -$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array(); |
190 |
| -$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0; |
191 |
| - |
192 | 194 | if ($PHPUNIT_VERSION < 8.0) {
|
193 | 195 | $argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; });
|
194 | 196 | } elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
|
|
0 commit comments