|
158 | 158 | }
|
159 | 159 |
|
160 | 160 | $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|
161 |
| - || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`)) |
162 |
| - || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`)) |
| 161 | + || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)) |
| 162 | + || ($COMPOSER = rtrim('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)) |
163 | 163 | || 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')
|
164 | 164 | ? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
165 | 165 | : 'composer';
|
|
185 | 185 | @mkdir($PHPUNIT_DIR, 0777, true);
|
186 | 186 | chdir($PHPUNIT_DIR);
|
187 | 187 | if (file_exists("$PHPUNIT_VERSION_DIR")) {
|
188 |
| - passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
| 188 | + passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s 2> NUL' : 'rm -rf %s', escapeshellarg("$PHPUNIT_VERSION_DIR.old"))); |
189 | 189 | rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
|
190 |
| - passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old")); |
| 190 | + passthru(sprintf('\\' === \DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', escapeshellarg("$PHPUNIT_VERSION_DIR.old"))); |
191 | 191 | }
|
192 | 192 |
|
193 | 193 | $info = [];
|
@@ -313,10 +313,15 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
|
313 | 313 | // This is useful for static analytics tools such as PHPStan having to load PHPUnit's classes
|
314 | 314 | // and for other testing libraries such as Behat using PHPUnit's assertions.
|
315 | 315 | chdir($PHPUNIT_DIR);
|
316 |
| -if (file_exists('phpunit')) { |
317 |
| - @unlink('phpunit'); |
| 316 | +if ('\\' === \DIRECTORY_SEPARATOR) { |
| 317 | + passthru('rmdir /S /Q phpunit 2> NUL'); |
| 318 | + passthru(sprintf('mklink /j phpunit %s > NUL 2>&1', escapeshellarg($PHPUNIT_VERSION_DIR))); |
| 319 | +} else { |
| 320 | + if (file_exists('phpunit')) { |
| 321 | + @unlink('phpunit'); |
| 322 | + } |
| 323 | + @symlink($PHPUNIT_VERSION_DIR, 'phpunit'); |
318 | 324 | }
|
319 |
| -@symlink($PHPUNIT_VERSION_DIR, 'phpunit'); |
320 | 325 | chdir($oldPwd);
|
321 | 326 |
|
322 | 327 | if ($PHPUNIT_VERSION < 8.0) {
|
|
0 commit comments