Skip to content

Commit 58c7de4

Browse files
committed
bug #36566 [PhpUnitBridge] Use COMPOSER_BINARY env var if available (fancyweb)
This PR was merged into the 3.4 branch. Discussion ---------- [PhpUnitBridge] Use COMPOSER_BINARY env var if available | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | symfony/symfony#36401 | License | MIT | Doc PR | - Commits ------- 6dce90d47b [PhpUnitBridge] Use COMPOSER_BINARY env var if available
2 parents 8287ac1 + 0b83e8a commit 58c7de4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

bin/simple-phpunit

+7-5
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ foreach ($defaultEnvs as $envName => $envValue) {
6565
}
6666
}
6767

68-
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
69-
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
70-
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`))
71-
? (file_get_contents($COMPOSER, false, null, 0, 18) === '#!/usr/bin/env php' ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
72-
: 'composer';
68+
if (false === $COMPOSER = \getenv('COMPOSER_BINARY')) {
69+
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
70+
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
71+
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`))
72+
? (file_get_contents($COMPOSER, false, null, 0, 18) === '#!/usr/bin/env php' ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
73+
: 'composer';
74+
}
7375

7476
if (false === $SYMFONY_PHPUNIT_REMOVE = getenv('SYMFONY_PHPUNIT_REMOVE')) {
7577
$SYMFONY_PHPUNIT_REMOVE = 'phpspec/prophecy symfony/yaml';

0 commit comments

Comments
 (0)