I've been working on writing unit tests for my PHP code. PHPUnit is what I'm using for this.
我一直在为我的PHP代码编写单元测试。 PHPUnit是我正在使用的。
I have some classes that work great until...
我有一些课程很有效,直到......
I throw XDebug into the mix.
我把XDebug扔进了组合。
At that point, PHPUnit doesn't crash or anything, but setExpectedException never triggers.
此时,PHPUnit不会崩溃或任何事情,但setExpectedException永远不会触发。
In fact, the code never goes beyond that point.
事实上,代码永远不会超越这一点。
Anyone run across this and know what the solution is?
有人遇到这个,知道解决方案是什么?
Edit: This is with the PHP5.2.6, Latest versions of XUnit and XDebug. This is on linux fedora 7
编辑:这是与PHP5.2.6,XUnit和XDebug的最新版本。这是在linux fedora 7上
1 个解决方案
#1
I've had some problems before with one combination of Xdebug & PHPUnit (as did others, from a report I say on devzone.zend.com at the time), but that was a while ago. PHPUnit does explicitly support Xdebug though - and I'm using it to produce code coverage reports for my own systems.
我之前在使用Xdebug和PHPUnit的一个组合时遇到了一些问题(正如我当时在devzone.zend.com上发表的一篇报道中的其他组合一样),但那是不久前的事了。虽然PHPUnit明确支持Xdebug - 我正在使用它来为我自己的系统生成代码覆盖率报告。
I'd suggest the fairly standard debugging techniques, updating any versions you can (maybe even PHP?) commenting out the @setExpectedException, or throwing it explicitly - and of course, making sure that you have full warnings and errors being shown with error_reporting(E_ALL|E_STRICT);
set on.
我建议使用相当标准的调试技术,更新任何版本(甚至是PHP?)注释掉@setExpectedException,或者明确地抛出它 - 当然,确保你有完整的警告和错误通过error_reporting显示( E_ALL | E_STRICT);出发。
Don't forget to stop and restart the Apache server to make sure that the Xdebug module is loaded as well.
不要忘记停止并重新启动Apache服务器以确保也加载了Xdebug模块。
#1
I've had some problems before with one combination of Xdebug & PHPUnit (as did others, from a report I say on devzone.zend.com at the time), but that was a while ago. PHPUnit does explicitly support Xdebug though - and I'm using it to produce code coverage reports for my own systems.
我之前在使用Xdebug和PHPUnit的一个组合时遇到了一些问题(正如我当时在devzone.zend.com上发表的一篇报道中的其他组合一样),但那是不久前的事了。虽然PHPUnit明确支持Xdebug - 我正在使用它来为我自己的系统生成代码覆盖率报告。
I'd suggest the fairly standard debugging techniques, updating any versions you can (maybe even PHP?) commenting out the @setExpectedException, or throwing it explicitly - and of course, making sure that you have full warnings and errors being shown with error_reporting(E_ALL|E_STRICT);
set on.
我建议使用相当标准的调试技术,更新任何版本(甚至是PHP?)注释掉@setExpectedException,或者明确地抛出它 - 当然,确保你有完整的警告和错误通过error_reporting显示( E_ALL | E_STRICT);出发。
Don't forget to stop and restart the Apache server to make sure that the Xdebug module is loaded as well.
不要忘记停止并重新启动Apache服务器以确保也加载了Xdebug模块。