Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e464c6

Browse files
committed
Allow relative path to composer cache
1 parent 6af4446 commit 6e464c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@
157157
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
158158
: 'composer';
159159

160+
$prevCacheDir = getenv('COMPOSER_CACHE_DIR');
161+
if ($prevCacheDir && !(strpos($prevCacheDir, '/') === 0 || substr($prevCacheDir, 1, 1) === ':' || strpos($prevCacheDir, '\\\\') === 0)) {
162+
$absoluteCacheDir = $oldPwd.'/'.$prevCacheDir;
163+
putenv("COMPOSER_CACHE_DIR=$absoluteCacheDir");
164+
}
160165
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml' : ''));
161166
$configurationHash = md5(implode(\PHP_EOL, [md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT]));
162167
$PHPUNIT_VERSION_DIR = sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT);
@@ -239,6 +244,7 @@
239244
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
240245
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress $q", [], $p, getcwd()));
241246
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
247+
putenv("COMPOSER_CACHE_DIR=$prevCacheDir");
242248
if ($exit) {
243249
exit($exit);
244250
}

0 commit comments

Comments
 (0)