Restart PHP process when code coverage data collection/processing is requested, Xdebug is loaded, but its mode is wrong
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
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
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.
Closed via #6237.