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