bug #30496 [PHPUnit-Bridge] override some Composer environment variables (nicoweb)
This PR was merged into the 3.4 branch.
Discussion
----------
[PHPUnit-Bridge] override some Composer environment variables
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30467
| License | MIT
| Doc PR | -
Override `COMPOSER_VENDOR_DIR` and `COMPOSER_BIN_DIR` with their default values in PHPUnit Bridge: #30467
Commits
-------
628502645e
[PHPUnit-Bridge] override some environment variables
This commit is contained in:
commit
42626744b2
@ -26,10 +26,7 @@ if (PHP_VERSION_ID >= 70200) {
|
|||||||
$PHPUNIT_VERSION = '4.8';
|
$PHPUNIT_VERSION = '4.8';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('composer.json' !== $COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json') {
|
$COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json';
|
||||||
putenv('COMPOSER=composer.json');
|
|
||||||
$_SERVER['COMPOSER'] = $_ENV['COMPOSER'] = 'composer.json';
|
|
||||||
}
|
|
||||||
|
|
||||||
$root = __DIR__;
|
$root = __DIR__;
|
||||||
while (!file_exists($root.'/'.$COMPOSER_JSON) || file_exists($root.'/DeprecationErrorHandler.php')) {
|
while (!file_exists($root.'/'.$COMPOSER_JSON) || file_exists($root.'/DeprecationErrorHandler.php')) {
|
||||||
@ -47,6 +44,19 @@ if ('phpdbg' === PHP_SAPI) {
|
|||||||
$PHP .= ' -qrr';
|
$PHP .= ' -qrr';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$defaultEnvs = [
|
||||||
|
'COMPOSER' => 'composer.json',
|
||||||
|
'COMPOSER_VENDOR_DIR' => 'vendor',
|
||||||
|
'COMPOSER_BIN_DIR' => 'bin',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($defaultEnvs as $envName => $envValue) {
|
||||||
|
if ($envValue !== getenv($envName)) {
|
||||||
|
putenv("$envName=$envValue");
|
||||||
|
$_SERVER[$envName] = $_ENV[$envName] = $envValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
|
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
|
||||||
? $PHP.' '.escapeshellarg($COMPOSER)
|
? $PHP.' '.escapeshellarg($COMPOSER)
|
||||||
: 'composer';
|
: 'composer';
|
||||||
|
Reference in New Issue
Block a user