phpunit icon indicating copy to clipboard operation
phpunit copied to clipboard

Restart PHP process when code coverage data collection/processing is requested, Xdebug is loaded, but its mode is wrong

Open staabm opened this issue 6 months ago • 2 comments

when I run vendor/bin/phpunit --coverage-html coverage_report phpunit is running and happily is working thru the test-suite, while after waiting for minutes for its completion it reports:

There was 1 PHPUnit test runner warning:

1) XDEBUG_MODE=coverage (environment variable) or xdebug.mode=coverage (PHP configuration setting) has to be set

when the xdebug extension is already loaded, but in the wrong mode, couldn't phpunit restart itself with a proper XDEBUG_MODE=coverage set, so I don't need to wait for the whole testsuite to finish and re-run it manually?

this would be useful, as I usually have xdebug loaded in debugging mode

staabm avatar Jun 08 '25 07:06 staabm

I found infection is doing the same thing, and I found it quite convenient:

https://github.com/infection/infection/blob/8059a67856e26944af051c5a600337187445204d/src/Process/OriginalPhpProcess.php#L64-L68

staabm avatar Jun 08 '25 07:06 staabm

Prior to PHPUnit 10, this message was displayed at the beginning, not at the end. So far I did not get around to remedy this.

That being said, I would accept a pull request that implements what you suggest. Bonus points if we do not need to add a new dependency for this.

sebastianbergmann avatar Jun 08 '25 10:06 sebastianbergmann

Closed via #6237.

sebastianbergmann avatar Jun 24 '25 06:06 sebastianbergmann