Enable xdebug only for PHPUnit command line

Published 18 March 2020 21:00 (1 minute read)

I don't want to enable xdebug for my normal PHPUnit test but only for the coverage report. Therefor I made a shortcut.

In my composer.json file I made this script:

  "scripts": {
    "coverage": "php -d zend_extension=xdebug.so ./vendor/bin/phpunit --prepend build/xdebug-filter.php --coverage-html build/coverage-report --coverage-text"

For more information see stackoverflow.

Robin Dirksen

Robin Dirksen

On my blog, you can find articles that I've found useful or wanted to share with anyone else.

If you want to know more about this article or just want to talk to me, don't hesitate to reach out.