|
163 | 163 | rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
|
164 | 164 | passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
|
165 | 165 | }
|
166 |
| - $passthruOrFail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\""); |
| 166 | + |
| 167 | + $info = []; |
| 168 | + foreach (explode("\n", `$COMPOSER info -a -n phpunit/phpunit "$PHPUNIT_VERSION.*"`) as $line) { |
| 169 | + $line = rtrim($line); |
| 170 | + |
| 171 | + if (!$info && preg_match('/^versions +: /', $line)) { |
| 172 | + $info['versions'] = explode(', ', ltrim(substr($line, 9), ': ')); |
| 173 | + } elseif (isset($info['requires'])) { |
| 174 | + if ('' === $line) { |
| 175 | + break; |
| 176 | + } |
| 177 | + |
| 178 | + $line = explode(' ', $line, 2); |
| 179 | + $info['requires'][$line[0]] = $line[1]; |
| 180 | + } elseif ($info && 'requires' === $line) { |
| 181 | + $info['requires'] = []; |
| 182 | + } |
| 183 | + } |
| 184 | + |
| 185 | + if (1 === \count($info['versions'])) { |
| 186 | + $passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi -s dev phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\""); |
| 187 | + } else { |
| 188 | + $passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\""); |
| 189 | + } |
| 190 | + |
167 | 191 | @copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
|
168 | 192 | chdir("$PHPUNIT_VERSION_DIR");
|
169 | 193 | if ($SYMFONY_PHPUNIT_REMOVE) {
|
|
173 | 197 | $passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
|
174 | 198 | }
|
175 | 199 |
|
| 200 | + if ($info['requires']['php'] !== $phpVersion = preg_replace('{\^([\d\.]++)$}', '>=$1', $info['requires']['php'])) { |
| 201 | + $passthruOrFail("$COMPOSER require --no-update \"php:$phpVersion\""); |
| 202 | + } |
176 | 203 | $passthruOrFail("$COMPOSER config --unset platform.php");
|
177 | 204 | if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
|
178 | 205 | $passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");
|
|
0 commit comments