I\'ve tried running the following CLI command:
phpunit -d xdebug.profiler_enable=on XYZTestCase.php
but it just runs as normal. Can anyone
Assuming you already have Xdebug working from your editor/standalone debugger when triggered by cookie/post/get variables, add a shell script to do the same triggering, so you have less to remember:
Create ~/bin/php-cli-debug.sh
:
#!/bin/bash
phpfile="$1"
idekey=YOUR_IDE_KEY
shift 1
php -d'xdebug.remote_enable=1' -d'xdebug.remote_autostart=1' -d'xdebug.idekey='"$idekey" -f "$phpfile" -- "$@"
Then to debug things on the CLI, use something like:
$ php-cli-debug.sh "$(which phpunit)" --bootstrap tests/bootstrap.php tests/FooBarTest | less -S
Make sure your .bashrc
has added ~/bin
to your $PATH
.