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

Skip to content

[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

Closed
wants to merge 2 commits into from

Conversation

amcastror
Copy link
Contributor

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.

Q A
Branch? master for features / 2.7 up to 4.0 for bug fixes
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

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';
Copy link
Member

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 beCOMPOSER` instead.

Copy link
Member

@nicolas-grekas nicolas-grekas Mar 12, 2018

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';
}

@amcastror
Copy link
Contributor Author

@fabpot, if we used COMPOSER as the var name, then other composer calls would fail:

screen shot 2018-03-10 at 5 39 31 pm
(composer-dev.json is the alternative name for composer.json in my project).

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 nicolas-grekas added this to the 3.4 milestone Mar 12, 2018
@nicolas-grekas nicolas-grekas changed the title Ability to use different composer.json file [PhpUnitBridge] Ability to use different composer.json file Mar 12, 2018
@amcastror
Copy link
Contributor Author

@nicolas-grekas, I can confirm it works using "COMPOSER":

screen shot 2018-03-12 at 1 19 22 pm

I updated the PR.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for 3.4)

@fabpot
Copy link
Member

fabpot commented Mar 13, 2018

Thank you @amcastror.

fabpot added a commit that referenced this pull request Mar 13, 2018
…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
@fabpot fabpot closed this Mar 13, 2018
This was referenced Apr 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants