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

Skip to content

PHPUnit Bridge fails in CI environment #34796

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
NoodlesNZ opened this issue Dec 4, 2019 · 0 comments
Closed

PHPUnit Bridge fails in CI environment #34796

NoodlesNZ opened this issue Dec 4, 2019 · 0 comments

Comments

@NoodlesNZ
Copy link

Symfony version(s) affected: 4.4.1

Description
When trying to install phpunit bridge in Scrutinizer CI it tries to guess the path for composer. For some strange reason $COMPOSER gets evaluated to:

'/home/scrutinizer/.phpenv/versions/7.3.0/bin/php' '/usr/bin/composer'

When you run this via the command line or via the simple-phpunit.php script it displays:

php /usr/bin/composer.phar $@

It then fails to create the $PHPUNIT_VERSION_DIR directory and thus everything else fails.

How to reproduce
Run ./bin/phpunit install inside Scrutinizer CI

Possible Solution
Check for COMPOSER_BIN environment variable and use that ahead of trying to work out the path.

Additional context

php /usr/bin/composer.phar $@
PHP Warning:  chdir(): No such file or directory (errno 2) in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 127

Warning: chdir(): No such file or directory (errno 2) in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 127

php /usr/bin/composer.phar $@

php /usr/bin/composer.phar $@

php /usr/bin/composer.phar $@

php /usr/bin/composer.phar $@
PHP Warning:  file_get_contents(./src/Framework/TestCase.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 156

Warning: file_get_contents(./src/Framework/TestCase.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 156
PHP Warning:  file_put_contents(./src/Framework/TestCase.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 161

Warning: file_put_contents(./src/Framework/TestCase.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 161
PHP Warning:  file_get_contents(./src/Framework/Assert.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 164

Warning: file_get_contents(./src/Framework/Assert.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 164
PHP Warning:  file_put_contents(./src/Framework/Assert.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 166

Warning: file_put_contents(./src/Framework/Assert.php): failed to open stream: No such file or directory in /home/scrutinizer/build/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php on line 166
nicolas-grekas added a commit that referenced this issue Jan 7, 2020
…, composer executable is wrapped into a bash script (oleg-andreyev)

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

Discussion
----------

[PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #34796
| License       | MIT
| Doc PR        | -

Locally using [phpenv](https://github.com/phpenv/phpenv) together [phpenv-composer](https://github.com/ngyuki/phpenv-composer) with for managing php versions and composer installations.

`which composer` is detecting wrapper instead of binary.
Before appending PHP executable to composer path need to validate that detected composer is not a wrapper otherwise PHP will simply return the content of a wrapper

Commits
-------

25c805e [PhpUnitBridge] When using phpenv + phpenv-composer plugin, composer executable is wrapped into a bash script
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

4 participants