Skip to content

Commit f530f01

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [HttpClient][PHPDoc] Fix 2 remaining return mixed [Cache] [FrameworkBundle] Fix logging for TagAwareAdapter [Route] Better inline requirements and defaults parsing Simplified condition and removed unused code from AbstractSessionListener::onKernelRequest [PhpUnitBridge] Fix phpunit symlink on Windows [Yaml] Fixed infinite loop when parser goes through an additional and invalid closing tag
2 parents f2f94fd + 7eab287 commit f530f01

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

bin/simple-phpunit.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@
158158
}
159159

160160
$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`))
163163
|| 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')
164164
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
165165
: 'composer';
@@ -185,9 +185,9 @@
185185
@mkdir($PHPUNIT_DIR, 0777, true);
186186
chdir($PHPUNIT_DIR);
187187
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")));
189189
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")));
191191
}
192192

193193
$info = [];
@@ -313,10 +313,15 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
313313
// This is useful for static analytics tools such as PHPStan having to load PHPUnit's classes
314314
// and for other testing libraries such as Behat using PHPUnit's assertions.
315315
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');
318324
}
319-
@symlink($PHPUNIT_VERSION_DIR, 'phpunit');
320325
chdir($oldPwd);
321326

322327
if ($PHPUNIT_VERSION < 8.0) {

0 commit comments

Comments
 (0)