如何从命令行使用PHPUnit运行XDebug?

时间:2013-09-06 10:03:52

标签: windows netbeans phpunit

我有netbeans在调试模式下运行。现在我想用?XDEBUG_SESSION_START = netbeans-xdebug运行单元测试,目标是在我去的时候有断点。有可能吗?

我试过这样的事情:

phpunit myTest.php?XDEBUG_SESSION_START=netbeans-xdebug

不起作用。有什么想法吗?

更新

根据这个:http://blog.doh.ms/2011/05/13/debugging-phpunit-tests-in-netbeans-with-xdebug/

  

转到命令行并运行phpunit-debug。现在调试开始,如果您选择“在第一行停止”,您的IDE将打开phpunit文件,点击播放即可关闭。

如果我运行phpunit --debug

Starting test 'xxxx'
OK (1 test, 4 assertions)

问题是,它从来没有抓住我在控制器中的断点。它为什么不赶上它?是否有可能是因为它是使用:

执行的
$this->dispatch('/ajax/update-bla');

1 个答案:

答案 0 :(得分:4)

试试这个 $ XDEBUG_CONFIG =“idekey = netbeans-xdebug”phpunit -c%yourconfing%.xml

或者你可以导出shell var
$ export XDEBUG_CONFIG =“idekey = netbeans-xdebug”

然后像往常一样运行phpunit $ phpunit -c%yourconfing%.xml

相关问题