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
PHP options should be passed to child processes #4664
Comments
Thank you for your report. Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting. Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue. |
Hi @sebastianbergmann ! Thanks for answering :) Here is the minimal, self-contained, reproducing test case that shows my issue. README included. https://github.com/robsontenorio/bug-phpunit It seems php options are not passed to child proccess when using php -d pcov.enabled=1 ./vendor/bin/phpunit ..... |
Given $config is with sections (parse_ini_file(, true)) and $value is the name of the ini directive, $config[$value] never is the value of the directive of the same name as in $value. $config = parse_ini_file($ini, true); -> $config = parse_ini_file($ini, false); |
Please, note pcov is disabled by default. As suggested on its docs. I am enabling pcov on demand with “php -d pcov.enabled=1 ...” |
Now that I look again, we're only interested in selected settings ...
That ought to do it ? |
What about this? My tests doesn't recognize xdebug extension when coverage is executed and my test has |
until further traction, please try with the XDEBUG_MODE environment parameter (exported), it works across all processes in the same environment (as long as the PHP CLI config loads the xdebug extension by default), so it won't need the mode ini setting passed along explicitly via command-line args (explicitly by |
Thanks for your help, @ktomk. I am using PHPStorm on Windows... Maybe this could be a problem... |
Yes, the XDEBUG_MODE environment parameter is for the currently supported Xdebug version only and does not apply to Xdebug version 2.
Please see Environment Variables - Command Line area - PHPUnit ... maybe it helps. |
Hello, @ktomk With the environment variable, my tests works. Thanks for your help. |
Any words on fixing this issue? |
I do not have time to work on this myself, but I would take the time to review a pull request. |
@robsontenorio Can you verify that sebastianbergmann/environment#63 fixes this for you? Thanks! |
@sebastianbergmann I've tested the issue @robsontenorio reported (with his example from the link), when I put the PHPUnit to version ^8 I got bash-5.1# php -d pcov.enabled=1 ./vendor/bin/phpunit
PHPUnit 8.5.26 #StandWithUkraine
Warning - The configuration file did not pass validation!
The following problems have been detected:
Line 11:
- Element 'coverage': This element is not expected.
Test results may not be as expected.
.. 2 / 2 (100%)
Time: 232 ms, Memory: 4.00 MB When I set the PHPUnit to be ^9.5, the latest environment package gets pulled and the results are correct: bash-5.1# php -d pcov.enabled=1 ./vendor/bin/phpunit
PHPUnit 9.5.20 #StandWithUkraine
.. 2 / 2 (100%)
Time: 00:00.357, Memory: 10.00 MB
OK (2 tests, 2 assertions)
Generating code coverage report in Clover XML format ... done [00:00.018]
Generating code coverage report in HTML format ... done [00:00.156] So I'd say that the issue is fixed. |
Thanks @dingo-d ! |
Summary
Regression of #3506
@remicollet can you confirm?
The text was updated successfully, but these errors were encountered: