Skip to content

Commit c117424

Browse files
[Bridge/PhpUnit] Use composer to download phpunit
1 parent e7e62a5 commit c117424

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

bin/simple-phpunit

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// 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
1515

1616
error_reporting(-1);
1717

@@ -60,29 +60,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
6060

6161
@mkdir($PHPUNIT_DIR, 0777, true);
6262
chdir($PHPUNIT_DIR);
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"));
65-
}
66-
if (extension_loaded('openssl') && filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN) && !isset($_SERVER['http_proxy']) && !isset($_SERVER['https_proxy'])) {
67-
$remoteZip = "https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip";
68-
$remoteZipStream = @fopen($remoteZip, 'rb');
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();
63+
passthru("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\"");
8664
chdir("phpunit-$PHPUNIT_VERSION");
8765
if ($SYMFONY_PHPUNIT_REMOVE) {
8866
passthru("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE);

0 commit comments

Comments
 (0)