Reputation: 13527
I have netbeans running in debug mode. Now I want to run a unit tests with ?XDEBUG_SESSION_START=netbeans-xdebug with the goal of having breakpoints as I go. Is it possible?
I tried something like this:
phpunit myTest.php?XDEBUG_SESSION_START=netbeans-xdebug
Doesn't work. Any ideas?
UPDATE
According to this: http://blog.doh.ms/2011/05/13/debugging-phpunit-tests-in-netbeans-with-xdebug/
Go to command line and run phpunit-debug. Now debugging starts, if you selected “Stop on first line” phpunit file will be opened on your IDE, click play and you are off.
If I run phpunit --debug
Starting test 'xxxx'
OK (1 test, 4 assertions)
Problem is, it never caught the breakpoint that I had in a controller. Why won't it catch it? Is it possible due to the fact that it is executed using:
$this->dispatch('/ajax/update-bla');
Upvotes: 3
Views: 3305
Reputation: 66
Try this
$ XDEBUG_CONFIG="idekey=netbeans-xdebug" phpunit -c %yourconfing%.xml
or you can export shell var
$ export XDEBUG_CONFIG="idekey=netbeans-xdebug"
and then just run phpunit as usual
$ phpunit -c %yourconfing%.xml
Upvotes: 5