如何设置 PHP + x调试+ (x)单位+ Eclipse 在单元测试中使用断点?
已经尝试了很长一段时间让它正常工作但没有运气。 基本上,我有带有 PHP 开发工具 (PDT) 的 Eclipse (3.3)、PDT XDebug 插件以及 SimpleTest eclipse 插件。
我想要做的是调试 SimpleTest 单元测试调用的代码。 SimpleTest 显然可以看到 XDebug,因为我可以生成代码覆盖率报告,但它不会在断点处停止。
编辑:应该补充一点,XDebug 和断点在 eclipse 中工作正常,只是在 SimpleTest 调用时不能
工作有人成功设置了吗? 周围有很多废话文档,但有用的信息却很少。
谢谢!
Have tried for quite some time to get this to work correctly but to no luck. Basically, I have Eclipse (3.3) with PHP Development Tools (PDT), and the PDT XDebug plugin as well as the SimpleTest eclipse plugin.
What I want to do is debug code invoked by SimpleTest unit tests. SimpleTest clearly can see XDebug, because I can generate code coverage reports, but it just won't stop on breakpoints.
Edit: Should add that XDebug and breakpoints work fine in eclipse, just not when invoked by SimpleTest
Has anyone set this up successfully? There's a lot of guff docs around and little in the way of useful information.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您的 PHP 版本有正确的 XDebug 版本,并将其添加到 php.ini 文件的开头:
然后执行
apachectl Graceful
和phpinfo
以及确保 XDebug 存在并且处于活动状态。 如果是的话,一切都应该正常。 我知道这对我有用。编辑:我在阅读整个问题之前就回答了。
在运行脚本之前,您应该设置环境变量;
也许可以从 php 执行此操作,但我无法测试这一点:
您应该确保您使用的 php 二进制文件已加载 XDebug 扩展,在我的系统上,apache 模块具有该扩展,但默认的 CLI 解释器没有,但是我故意运行不同的版本。
这里有一些好的文档
Make sure you have the right XDebug version for your version of PHP and add this at the very beginning of your php.ini file:
Then do an
apachectl graceful
and aphpinfo
and make sure XDebug is present and active. If it is, everything should work fine. I know it does for me.edit: I answered before reading the entire question.
before running the script you should set the environment variable;
It might be possible to do this from php but i cannot test this:
You should make sure that the php binary you are using has the XDebug extension loaded, on my system the apache module has it, but the default CLI interpreter does not, but I run different versions on purpose.
There's some good documentation here
为了进一步了解 Kris 的答案,如果您在同一台服务器上管理生产和开发环境,最好将您的 xdebug 设置降级为
php include
或您的virtualhosts
专用于dev
或testing
环境:virtualhosts 的语法是
To go further on Kris' answer, If you manage your production and development environments on the same Server, It's a good idea to relegate your xdebug settings either to a
php include
or to those of yourvirtualhosts
which are dedicated todev
ortesting
environments :the syntax for virtualhosts is