|
151 | 151 | }
|
152 | 152 |
|
153 | 153 | $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|
154 |
| - || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`)) |
155 |
| - || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`)) |
| 154 | + || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)) |
| 155 | + || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)) |
156 | 156 | || file_exists($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`).\DIRECTORY_SEPARATOR.'composer.phar')
|
157 | 157 | ? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
158 | 158 | : 'composer';
|
|
178 | 178 | @mkdir($PHPUNIT_DIR, 0777, true);
|
179 | 179 | chdir($PHPUNIT_DIR);
|
180 | 180 | if (file_exists("$PHPUNIT_VERSION_DIR")) {
|
181 |
| - passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
| 181 | + passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s 2> NUL' : 'rm -rf %s', escapeshellarg("$PHPUNIT_VERSION_DIR.old"))); |
182 | 182 | rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
|
183 |
| - passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
| 183 | + passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', escapeshellarg("$PHPUNIT_VERSION_DIR.old"))); |
184 | 184 | }
|
185 | 185 |
|
186 | 186 | $info = [];
|
@@ -306,10 +306,15 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
|
306 | 306 | // This is useful for static analytics tools such as PHPStan having to load PHPUnit's classes
|
307 | 307 | // and for other testing libraries such as Behat using PHPUnit's assertions.
|
308 | 308 | chdir($PHPUNIT_DIR);
|
309 |
| -if (file_exists('phpunit')) { |
310 |
| - @unlink('phpunit'); |
| 309 | +if ('\\' === \DIRECTORY_SEPARATOR) { |
| 310 | + passthru('rmdir /S /Q phpunit 2> NUL'); |
| 311 | + passthru(sprintf('mklink /j phpunit %s > NUL 2>&1', escapeshellarg($PHPUNIT_VERSION_DIR))); |
| 312 | +} else { |
| 313 | + if (file_exists('phpunit')) { |
| 314 | + @unlink('phpunit'); |
| 315 | + } |
| 316 | + @symlink($PHPUNIT_VERSION_DIR, 'phpunit'); |
311 | 317 | }
|
312 |
| -@symlink($PHPUNIT_VERSION_DIR, 'phpunit'); |
313 | 318 | chdir($oldPwd);
|
314 | 319 |
|
315 | 320 | if ($PHPUNIT_VERSION < 8.0) {
|
|
0 commit comments