|
15 | 15 |
|
16 | 16 | error_reporting(-1);
|
17 | 17 |
|
| 18 | +$passthruOrFail = function ($command) { |
| 19 | + passthru($command, $status); |
| 20 | + |
| 21 | + if ($status) { |
| 22 | + exit($status); |
| 23 | + } |
| 24 | +}; |
| 25 | + |
18 | 26 | if (PHP_VERSION_ID >= 70200) {
|
19 | 27 | // PHPUnit 6 is required for PHP 7.2+
|
20 | 28 | $PHPUNIT_VERSION = getenv('SYMFONY_PHPUNIT_VERSION') ?: '6.5';
|
@@ -77,25 +85,25 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
|
77 | 85 | rename("phpunit-$PHPUNIT_VERSION", "phpunit-$PHPUNIT_VERSION.old");
|
78 | 86 | passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
|
79 | 87 | }
|
80 |
| - passthru("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\""); |
| 88 | + $passthruOrFail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\""); |
81 | 89 | @copy("phpunit-$PHPUNIT_VERSION/phpunit.xsd", 'phpunit.xsd');
|
82 | 90 | chdir("phpunit-$PHPUNIT_VERSION");
|
83 | 91 | if ($SYMFONY_PHPUNIT_REMOVE) {
|
84 |
| - passthru("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE); |
| 92 | + $passthruOrFail("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE); |
85 | 93 | }
|
86 | 94 | if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
|
87 |
| - passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); |
| 95 | + $passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); |
88 | 96 | }
|
89 | 97 |
|
90 |
| - passthru("$COMPOSER config --unset platform"); |
| 98 | + $passthruOrFail("$COMPOSER config --unset platform"); |
91 | 99 | if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
|
92 |
| - passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\""); |
93 |
| - passthru("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path))); |
| 100 | + $passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\""); |
| 101 | + $passthruOrFail("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path))); |
94 | 102 | if ('\\' === DIRECTORY_SEPARATOR) {
|
95 | 103 | file_put_contents('composer.json', preg_replace('/^( {8})"phpunit-bridge": \{$/m', "$0\n$1 ".'"options": {"symlink": false},', file_get_contents('composer.json')));
|
96 | 104 | }
|
97 | 105 | } else {
|
98 |
| - passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*\""); |
| 106 | + $passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*\""); |
99 | 107 | }
|
100 | 108 | $prevRoot = getenv('COMPOSER_ROOT_VERSION');
|
101 | 109 | putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
|
|
0 commit comments