comparison vendor/symfony/phpunit-bridge/bin/simple-phpunit @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
9 * For the full copyright and license information, please view the LICENSE 9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code. 10 * file that was distributed with this source code.
11 */ 11 */
12 12
13 // Please update when phpunit needs to be reinstalled with fresh deps: 13 // Please update when phpunit needs to be reinstalled with fresh deps:
14 // Cache-Id-Version: 2017-11-22 09:30 UTC 14 // Cache-Id-Version: 2018-11-20 15:30 UTC
15 15
16 error_reporting(-1); 16 error_reporting(-1);
17 17
18 if (PHP_VERSION_ID >= 70200) { 18 if (PHP_VERSION_ID >= 70200) {
19 // PHPUnit 6 is required for PHP 7.2+ 19 // PHPUnit 6 is required for PHP 7.2+
59 // Build a standalone phpunit without symfony/yaml nor prophecy by default 59 // Build a standalone phpunit without symfony/yaml nor prophecy by default
60 60
61 @mkdir($PHPUNIT_DIR, 0777, true); 61 @mkdir($PHPUNIT_DIR, 0777, true);
62 chdir($PHPUNIT_DIR); 62 chdir($PHPUNIT_DIR);
63 if (file_exists("phpunit-$PHPUNIT_VERSION")) { 63 if (file_exists("phpunit-$PHPUNIT_VERSION")) {
64 passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION")); 64 passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
65 } 65 rename("phpunit-$PHPUNIT_VERSION", "phpunit-$PHPUNIT_VERSION.old");
66 if (extension_loaded('openssl') && ini_get('allow_url_fopen') && !isset($_SERVER['http_proxy']) && !isset($_SERVER['https_proxy'])) { 66 passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
67 $remoteZip = "https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip"; 67 }
68 $remoteZipStream = @fopen($remoteZip, 'rb'); 68 passthru("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\"");
69 if (!$remoteZipStream) {
70 throw new \RuntimeException("Could not find $remoteZip");
71 }
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");
75 } else {
76 @unlink("$PHPUNIT_VERSION.zip");
77 passthru("wget -q https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip");
78 }
79 if (!class_exists('ZipArchive')) {
80 throw new \Exception('simple-phpunit requires the "zip" PHP extension to be installed and enabled in order to uncompress the downloaded PHPUnit packages.');
81 }
82 $zip = new ZipArchive();
83 $zip->open("$PHPUNIT_VERSION.zip");
84 $zip->extractTo(getcwd());
85 $zip->close();
86 chdir("phpunit-$PHPUNIT_VERSION"); 69 chdir("phpunit-$PHPUNIT_VERSION");
87 if ($SYMFONY_PHPUNIT_REMOVE) { 70 if ($SYMFONY_PHPUNIT_REMOVE) {
88 passthru("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE); 71 passthru("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE);
89 } 72 }
90 if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) { 73 if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
99 } else { 82 } else {
100 passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*\""); 83 passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*\"");
101 } 84 }
102 $prevRoot = getenv('COMPOSER_ROOT_VERSION'); 85 $prevRoot = getenv('COMPOSER_ROOT_VERSION');
103 putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); 86 putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
104 $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-suggest --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true))); 87 // --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
88 $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true)));
105 putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : '')); 89 putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
106 if ($exit) { 90 if ($exit) {
107 exit($exit); 91 exit($exit);
108 } 92 }
109 file_put_contents('phpunit', <<<'EOPHP' 93 file_put_contents('phpunit', <<<'EOPHP'
211 195
212 // Fail on any individual component failures but ignore some error codes on Windows when APCu is enabled: 196 // Fail on any individual component failures but ignore some error codes on Windows when APCu is enabled:
213 // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409) 197 // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409)
214 // STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005) 198 // STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005)
215 // STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374) 199 // STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374)
216 if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !ini_get('apc.enable_cli') || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) { 200 if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) {
217 $exit = $procStatus; 201 $exit = $procStatus;
218 echo "\033[41mKO\033[0m $component\n\n"; 202 echo "\033[41mKO\033[0m $component\n\n";
219 } else { 203 } else {
220 echo "\033[32mOK\033[0m $component\n\n"; 204 echo "\033[32mOK\033[0m $component\n\n";
221 } 205 }