From 3fb33fb3c2cef8cce332ebaf6b6aa077909c4c65 Mon Sep 17 00:00:00 2001 From: amcastror Date: Sat, 10 Mar 2018 15:48:33 -0300 Subject: [PATCH 1/2] Ability to use different composer.json file Hi, I have a project where I use a different composer.json via environment variable. Look here. Because of this, $root gets set to "/" and everything fails. Hope this helps. --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 2f97e32e1181..621cdc509b4d 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -26,8 +26,10 @@ if (PHP_VERSION_ID >= 70200) { $PHPUNIT_VERSION = '4.8'; } +COMPOSER_FILE_NAME = getenv('COMPOSER_FILE_NAME') ? : 'composer.json'; + $root = __DIR__; -while (!file_exists($root.'/composer.json') || file_exists($root.'/DeprecationErrorHandler.php')) { +while (!file_exists($root.'/'.$COMPOSER_FILE_NAME) || file_exists($root.'/DeprecationErrorHandler.php')) { if ($root === dirname($root)) { break; } From a8f8c6e71cdfdd5741320fae1473adcbd87500a3 Mon Sep 17 00:00:00 2001 From: amcastror Date: Mon, 12 Mar 2018 13:20:53 -0300 Subject: [PATCH 2/2] Updated following suggestions from Nicolas --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 621cdc509b4d..a549cd7da4fb 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -26,10 +26,13 @@ if (PHP_VERSION_ID >= 70200) { $PHPUNIT_VERSION = '4.8'; } -COMPOSER_FILE_NAME = getenv('COMPOSER_FILE_NAME') ? : 'composer.json'; +if ('composer.json' !== $COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json') { + putenv('COMPOSER=composer.json'); + $_SERVER['COMPOSER'] = $_ENV['COMPOSER'] = 'composer.json'; +} $root = __DIR__; -while (!file_exists($root.'/'.$COMPOSER_FILE_NAME) || file_exists($root.'/DeprecationErrorHandler.php')) { +while (!file_exists($root.'/'.$COMPOSER_JSON) || file_exists($root.'/DeprecationErrorHandler.php')) { if ($root === dirname($root)) { break; }