I don't want to turn on xdebug code coverage for all scripts but I do want to be able to turn it on for a daily jenkins build which produces the code coverage.
I tried the following
phpunit -d xdebug.coverage_enable=1 -c phpunit-coverage.xml.dist
However I always get the following error
Configuration read from phpunit-coverage.xml.dist
Fatal error: Uncaught exception 'PHP_CodeCoverage_Exception' with message 'You need to set xdebug.coverage_enable=On in your php.ini.' in /usr/local/lib/php/PHP/CodeCoverage/Driver/Xdebug.php on line 72
PHP_CodeCoverage_Exception: You need to set xdebug.coverage_enable=On in your php.ini. in /usr/local/lib/php/PHP/CodeCoverage/Driver/Xdebug.php on line 72
Call Stack:
0.0002 627488 1. {main}() /usr/local/bin/phpunit:0
0.0050 1095880 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:46
0.0050 1096608 3. PHPUnit_TextUI_Command->run() /usr/local/lib/php/PHPUnit/TextUI/Command.php:130
0.6419 39830848 4. PHPUnit_TextUI_TestRunner->doRun() /usr/local/lib/php/PHPUnit/TextUI/Command.php:192
0.9760 40345400 5. PHP_CodeCoverage->__construct() /usr/local/lib/php/PHPUnit/TextUI/TestRunner.php:258
0.9764 40358504 6. PHP_CodeCoverage_Driver_Xdebug->__construct() /usr/local/lib/php/PHP/CodeCoverage.php:119
Any ideas as to how I can get this to work, without having to change php.ini each time?
Yes, it can but only by running it like this:
php -dxdebug.mode=coverage bin/phpunit --coverage-clover='reports/coverage/coverage.xml' --coverage-html='reports/coverage'
Note: "..Xdebug: [Config] The setting 'xdebug.coverage_enable' has been renamed,.."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With