8000 [Simple-phpunit] Composer.phar require to be in the path · Issue #26637 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Simple-phpunit] Composer.phar require to be in the path #26637

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
FroggDev opened this issue Mar 22, 2018 · 7 comments
Closed

[Simple-phpunit] Composer.phar require to be in the path #26637

FroggDev opened this issue Mar 22, 2018 · 7 comments

Comments

@FroggDev
Copy link
FroggDev commented Mar 22, 2018

[Simple-phpunit] Composer.phar require to be in the path

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 3.4.0

(On windows) if composer.phar is not in the path as composer.bat the "php bin/phpunit" command will make an error.
in /vendor/symfony/phpunit-bridge/bin/simple-phpunit line 46 where.exe composer.phar

For example:
c:\dev\path\composer.bat content:
@php "C:\dev\composer\composer.phar" %*

composer.bat is in the path & composer.phar is in composer folder which is not in the path.

In this case the php bin/phpunit will trigger an error.

Maybe it is possible to set an error message to the user to explain this. Or maybe work with composer.bat instead of composer.phar.

@FroggDev FroggDev changed the title [Simple-phpunit] Composer.phar require to in the path [Simple-phpunit] Composer.phar require to be in the path Mar 22, 2018
@nicolas-grekas
Copy link
Member

I'm not 100% sure to understand the issue, but if you want to submit a PR, please do :)

@FroggDev
Copy link
Author
FroggDev commented Apr 7, 2018

i am currently busy with an end of training project on symfony, but once i'am done (around 3weeks from now) i will try a PR !

@xabbuh
Copy link
Member
xabbuh commented Apr 9, 2018

@FroggyDev Did you create the composer.bat file yourself or is it created by the Composer installer?

@FroggDev
Copy link
Author

To figure this out i create a composer.bat with a link to composer.phar in it, as it is in path "composer" command work but composer.phar isnt in the same folder (like that i can separate tool from path which is a better practice for security).

Anyway I am thinking just about a minor PR warning users that did like me to put composer.phar in same path as composer.bat.

Even if i think it would be better to rely on "composer" command rather than composer.phar.

@graste
Copy link
graste commented May 21, 2018

Same happens with linux etc. Running bin/phpunit or vendor/bin/simple-phgunit without composer in PATH results in:

sh: 1: composer: not found
sh: 1: composer: not found
sh: 1: composer: not found
sh: 1: composer: not found

The simple-phpunit script falls back to "composer" when "composer.phar" is not in the correct folder and then fails when "composer" is not in the PATH somewhere. Maybe a warning message, that the script falls back to "composer" or expects "composer.phar" in a certain directory might help. Additionally a hint, that one should set PATH or make "composer" available otherwise might help. As composer doesn't have a COMPOSER_PHAR or similar ENV variable IMHO, maybe symfony could introduce and check a APP_COMPOSER_BINARY environment variable? OTOH it's the same with PHP executable, which etc. not available...

@Simperfit
Copy link
Contributor

@nicolas-grekas what do you think of such a warning ? @FroggDev do you still want to create the PR ?

@FroggDev
Copy link
Author

@Simperfit Hi sorry for the late answer, you can take it, i am really busy nowadays

nicolas-grekas added a commit that referenced this issue Nov 5, 2019
…t folder (MaPePeR)

This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Also search for composer.phar in git root folder

| Q             | A
| ------------- | ---
| Branch?       | 4.4 for features
| Bug fix?      | kindof
| New feature?  | addition to existing feature
| Deprecations? | no
| Tickets       | Related: #26637 (comment)
| License       | MIT

When you don't have a system `composer` installation, but a `composer.phar` in the project folder, you cannot use the `simple-phpunit` script from a subfolder of the project with e.g. `../vendor/bin/simple-phpunit`.

This change also searches for the `composer.phar` in the current git root folder if it was not found at any o
5B62
ther places to increase the likelihood of it being found.

Commits
-------

97fd204 [PhpUnitBridge] Also search for composer.phar in git root folder
@fabpot fabpot closed this as completed Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants
0