bug #21143 [PhpUnitBridge] Set COMPOSER_ROOT_VERSION while installing (nicolas-grekas)

This PR was merged into the 3.2 branch.

Discussion
----------

[PhpUnitBridge] Set COMPOSER_ROOT_VERSION while installing

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

8bab09e [PhpUnitBridge] Set COMPOSER_ROOT_VERSION while installing
This commit is contained in:
Nicolas Grekas 2017-01-03 10:28:43 +01:00
commit 4020a0dda2
1 changed files with 3 additions and 0 deletions

View File

@ -48,12 +48,15 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
$zip->extractTo(getcwd());
$zip->close();
chdir("phpunit-$PHPUNIT_VERSION");
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION");
passthru("$COMPOSER remove --no-update ".(getenv('SYMFONY_PHPUNIT_REMOVE') ?: 'phpspec/prophecy symfony/yaml'));
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
}
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \">=3.2@dev\"");
passthru("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", $exit);
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
if ($exit) {
exit($exit);
}