Skip to content

Commit 605ddad

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: [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 [Form] Fix 'invalid_message' use in multiple ChoiceType
2 parents 448f9f3 + f530f01 commit 605ddad

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
@@ -148,8 +148,8 @@
148148
}
149149

150150
$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`))
153153
|| 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')
154154
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
155155
: 'composer';
@@ -176,9 +176,9 @@
176176
@mkdir($PHPUNIT_DIR, 0777, true);
177177
chdir($PHPUNIT_DIR);
178178
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")));
180180
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")));
182182
}
183183

184184
$info = [];
@@ -307,10 +307,15 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
307307
// This is useful for static analytics tools such as PHPStan having to load PHPUnit's classes
308308
// and for other testing libraries such as Behat using PHPUnit's assertions.
309309
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');
312318
}
313-
@symlink($PHPUNIT_VERSION_DIR, 'phpunit');
314319
chdir($oldPwd);
315320

316321
if ($PHPUNIT_VERSION < 8.0) {

0 commit comments

Comments
 (0)