For more information on remote debugging see Derick Rethan's 2011 post
For info on debugging PHP CLI with PhpStorm see Gary Hockin's post - DEBUGGING PHP COMMAND LINE (WITH PHP STORM & XDEBUG)
Connect to vagrant using an ssh tunnel and run phpunit through there. The same process applies when running a normal PHP CLI script.
ssh -R 9000:localhost:9000 [email protected]
password is vagrant
As a work around on the issue with Path Mappings (with PhpStorm), download phpunit.phar and put it in the tests folder.
cd /var/www/mysite/tests
export XDEBUG_CONFIG="idekey=PhpStorm1"
php phpunit.phar -c phpunit.xml Domain/User/UserTest.php
As long as you've set PhpStorm to listen to port 9000 and have started listening for PHP Debug Connections, the only thing remaining to set is the path mappings.
Also (very important) becuse we're using a phar
file, PhpStorm will show this warning:
Can't compute source position. The script 'phpunit.phar' isn't associated with any text file type.
To overcome that, just set a breakpoint and press play.
unset XDEBUG_CONFIG