|
53 | 53 | return $default;
|
54 | 54 | };
|
55 | 55 |
|
| 56 | +function passthru_or_fail($command) { |
| 57 | + passthru($command, $return); |
| 58 | + if ($return !== 0) { |
| 59 | + exit(99); |
| 60 | + } |
| 61 | +} |
| 62 | + |
56 | 63 | if (PHP_VERSION_ID >= 70200) {
|
57 | 64 | // PHPUnit 8 requires PHP 7.2+
|
58 | 65 | $PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '8.3');
|
|
118 | 125 | @mkdir($PHPUNIT_DIR, 0777, true);
|
119 | 126 | chdir($PHPUNIT_DIR);
|
120 | 127 | if (file_exists("$PHPUNIT_VERSION_DIR")) {
|
121 |
| - passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
| 128 | + passthru_or_fail(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
122 | 129 | rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
|
123 |
| - passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
| 130 | + passthru_or_fail(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
124 | 131 | }
|
125 |
| - passthru("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\""); |
| 132 | + passthru_or_fail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\""); |
126 | 133 | @copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
|
127 | 134 | chdir("$PHPUNIT_VERSION_DIR");
|
128 | 135 | if ($SYMFONY_PHPUNIT_REMOVE) {
|
129 |
| - passthru("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE); |
| 136 | + passthru_or_fail("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE); |
130 | 137 | }
|
131 | 138 | if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
|
132 |
| - passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); |
| 139 | + passthru_or_fail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\""); |
133 | 140 | }
|
134 | 141 |
|
135 |
| - passthru("$COMPOSER config --unset platform"); |
| 142 | + passthru_or_fail("$COMPOSER config --unset platform"); |
136 | 143 | if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
|
137 |
| - passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\""); |
138 |
| - passthru("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path))); |
| 144 | + passthru_or_fail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\""); |
| 145 | + passthru_or_fail("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path))); |
139 | 146 | if ('\\' === DIRECTORY_SEPARATOR) {
|
140 | 147 | file_put_contents('composer.json', preg_replace('/^( {8})"phpunit-bridge": \{$/m', "$0\n$1 ".'"options": {"symlink": false},', file_get_contents('composer.json')));
|
141 | 148 | }
|
142 | 149 | } else {
|
143 |
| - passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*\""); |
| 150 | + passthru_or_fail("$COMPOSER require --no-update symfony/phpunit-bridge \"*\""); |
144 | 151 | }
|
145 | 152 | $prevRoot = getenv('COMPOSER_ROOT_VERSION');
|
146 | 153 | putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
|
|
0 commit comments