Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/phpunit-bridge/bin/simple-phpunit @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 1fec387a4317 |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
45 $PHP = escapeshellarg($PHP); | 45 $PHP = escapeshellarg($PHP); |
46 if ('phpdbg' === PHP_SAPI) { | 46 if ('phpdbg' === PHP_SAPI) { |
47 $PHP .= ' -qrr'; | 47 $PHP .= ' -qrr'; |
48 } | 48 } |
49 | 49 |
50 $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar`)) | 50 $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`)) |
51 ? $PHP.' '.escapeshellarg($COMPOSER) | 51 ? $PHP.' '.escapeshellarg($COMPOSER) |
52 : 'composer'; | 52 : 'composer'; |
53 | 53 |
54 if (false === $SYMFONY_PHPUNIT_REMOVE = getenv('SYMFONY_PHPUNIT_REMOVE')) { | 54 if (false === $SYMFONY_PHPUNIT_REMOVE = getenv('SYMFONY_PHPUNIT_REMOVE')) { |
55 $SYMFONY_PHPUNIT_REMOVE = 'phpspec/prophecy symfony/yaml'; | 55 $SYMFONY_PHPUNIT_REMOVE = 'phpspec/prophecy symfony/yaml'; |
68 $remoteZipStream = @fopen($remoteZip, 'rb'); | 68 $remoteZipStream = @fopen($remoteZip, 'rb'); |
69 if (!$remoteZipStream) { | 69 if (!$remoteZipStream) { |
70 throw new \RuntimeException("Could not find $remoteZip"); | 70 throw new \RuntimeException("Could not find $remoteZip"); |
71 } | 71 } |
72 stream_copy_to_stream($remoteZipStream, fopen("$PHPUNIT_VERSION.zip", 'wb')); | 72 stream_copy_to_stream($remoteZipStream, fopen("$PHPUNIT_VERSION.zip", 'wb')); |
73 } elseif ('\\' === DIRECTORY_SEPARATOR) { | |
74 passthru("certutil -urlcache -split -f \"https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip\" $PHPUNIT_VERSION.zip"); | |
73 } else { | 75 } else { |
74 @unlink("$PHPUNIT_VERSION.zip"); | 76 @unlink("$PHPUNIT_VERSION.zip"); |
75 passthru("wget https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip"); | 77 passthru("wget -q https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip"); |
76 } | 78 } |
77 if (!class_exists('ZipArchive')) { | 79 if (!class_exists('ZipArchive')) { |
78 throw new \Exception('simple-phpunit requires the "zip" PHP extension to be installed and enabled in order to uncompress the downloaded PHPUnit packages.'); | 80 throw new \Exception('simple-phpunit requires the "zip" PHP extension to be installed and enabled in order to uncompress the downloaded PHPUnit packages.'); |
79 } | 81 } |
80 $zip = new ZipArchive(); | 82 $zip = new ZipArchive(); |
185 } else { | 187 } else { |
186 $exit = 1; | 188 $exit = 1; |
187 echo "\033[41mKO\033[0m $component\n\n"; | 189 echo "\033[41mKO\033[0m $component\n\n"; |
188 } | 190 } |
189 } | 191 } |
190 | |
191 // Fixes for colors support on appveyor | |
192 // See https://github.com/appveyor/ci/issues/373 | |
193 $colorFixes = array( | |
194 array("S\033[0m\033[0m\033[36m\033[1mS", "E\033[0m\033[0m\033[31m\033[1mE", "I\033[0m\033[0m\033[33m\033[1mI", "F\033[0m\033[0m\033[41m\033[37mF"), | |
195 array("SS", "EE", "II", "FF"), | |
196 ); | |
197 $colorFixes[0] = array_merge($colorFixes[0], $colorFixes[0]); | |
198 $colorFixes[1] = array_merge($colorFixes[1], $colorFixes[1]); | |
199 | 192 |
200 while ($runningProcs) { | 193 while ($runningProcs) { |
201 usleep(300000); | 194 usleep(300000); |
202 $terminatedProcs = array(); | 195 $terminatedProcs = array(); |
203 foreach ($runningProcs as $component => $proc) { | 196 foreach ($runningProcs as $component => $proc) { |
210 } | 203 } |
211 | 204 |
212 foreach ($terminatedProcs as $component => $procStatus) { | 205 foreach ($terminatedProcs as $component => $procStatus) { |
213 foreach (array('out', 'err') as $file) { | 206 foreach (array('out', 'err') as $file) { |
214 $file = "$component/phpunit.std$file"; | 207 $file = "$component/phpunit.std$file"; |
215 | 208 readfile($file); |
216 if ('\\' === DIRECTORY_SEPARATOR) { | |
217 $h = fopen($file, 'rb'); | |
218 while (false !== $line = fgets($h)) { | |
219 echo str_replace($colorFixes[0], $colorFixes[1], preg_replace( | |
220 '/(\033\[[0-9]++);([0-9]++m)(?:(.)(\033\[0m))?/', | |
221 "$1m\033[$2$3$4$4", | |
222 $line | |
223 )); | |
224 } | |
225 fclose($h); | |
226 } else { | |
227 readfile($file); | |
228 } | |
229 unlink($file); | 209 unlink($file); |
230 } | 210 } |
231 | 211 |
232 // Fail on any individual component failures but ignore some error codes on Windows when APCu is enabled: | 212 // Fail on any individual component failures but ignore some error codes on Windows when APCu is enabled: |
233 // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409) | 213 // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409) |