bug #41780 [PhpUnitBridge] fix handling the COMPOSER_BINARY env var when using simple-phpunit (Taluu)
This PR was merged into the 4.4 branch.
Discussion
----------
[PhpUnitBridge] fix handling the COMPOSER_BINARY env var when using simple-phpunit
| Q | A
| ------------- | ---
| Branch? | 4.4 and next
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #41774
| License | MIT
Since the renaming of the simple phpunit file (from the shebang to the php file) in #31364, it looks like the change made from #36566 was lost as it seems to have been merged after.
So this PR is an attempt to "restore" that functionnality, as it was considered a bug fix on 3.4 at the time.
poke `@nicolas`-grekas
Commits
-------
9589b52a78
Reapply the change to allow to set the composer binary path
This commit is contained in:
commit
8a32526db8
@ -150,12 +150,14 @@ if ('disabled' === $getEnvVar('SYMFONY_DEPRECATIONS_HELPER')) {
|
|||||||
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
|
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|
if (false === $COMPOSER = getenv('COMPOSER_BINARY')) {
|
||||||
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)))
|
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|
||||||
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)))
|
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)))
|
||||||
|| file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar')
|
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)))
|
||||||
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
|| file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar')
|
||||||
: 'composer';
|
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
||||||
|
: 'composer';
|
||||||
|
}
|
||||||
|
|
||||||
$prevCacheDir = getenv('COMPOSER_CACHE_DIR');
|
$prevCacheDir = getenv('COMPOSER_CACHE_DIR');
|
||||||
if ($prevCacheDir) {
|
if ($prevCacheDir) {
|
||||||
|
Reference in New Issue
Block a user