-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PhpUnitBridge] Ability to use different composer.json file #26482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@@ -26,8 +26,10 @@ if (PHP_VERSION_ID >= 70200) { | |||
$PHPUNIT_VERSION = '4.8'; | |||
} | |||
|
|||
COMPOSER_FILE_NAME = getenv('COMPOSER_FILE_NAME') ? : 'composer.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMPOSER_FILE_NAMEis non-standard. According to https://getcomposer.org/doc/03-cli.md#environment-variables, it should be
COMPOSER` instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work:
if ('composer.json' !== $COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json') {
putenv('COMPOSER=composer.json');
$_SERVER['COMPOSER'] = $_ENV['COMPOSER'] = 'composer.json';
}
@fabpot, if we used COMPOSER as the var name, then other composer calls would fail:
I'm not sure at which point it fails, I could look in to it but I'll need some more time. Do you have any ideas why that fails? |
@nicolas-grekas, I can confirm it works using "COMPOSER": I updated the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for 3.4)
Thank you @amcastror. |
…e (amcastror) This PR was submitted for the master branch but it was squashed and merged into the 3.4 branch instead (closes #26482). Discussion ---------- [PhpUnitBridge] Ability to use different composer.json file Hi, I have a project where I use a different composer.json via environment variable. Look [here](https://getcomposer.org/doc/03-cli.md#composer). Because of this, $root gets set to "/" and everything fails. Hope this helps. | Q | A | ------------- | --- | Branch? | master for features / 2.7 up to 4.0 for bug fixes <!-- see below --> | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | I'll add if this is useful. | Fixed tickets | | License | MIT | Doc PR | symfony/symfony-docs <!-- Write a short README entry for your feature/bugfix here (replace this comment block.) This will help people understand your PR and can be used as a start of the Doc PR. Additionally: - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. --> Commits ------- 77e643d [PhpUnitBridge] 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.