一起使用 netbeans、xdebug、symfony 和 phpunit
我在 Apache 上安装了 xdebug,如果我在 Netbeans 中定义断点,则执行会正常中断。但是,如果我使用 symfony phpunit:test-all 执行测试,则执行不会在给定的断点处中断。
有什么想法吗? 科瓦邦加!
I installed xdebug on my Apache and if I define a breakpoint in Netbeans, the execution breaks fine. But if I execute the tests with symfony phpunit:test-all
, the execution will not break on the given break point.
Any ideas?
cowabunga!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要调试命令行脚本,请先导出
XDEBUG_CONFIG
变量,如下所示:export XDEBUG_CONFIG="idekey=netbeans-xdebug"
(Unix/Linux/OS X)< code>set XDEBUG_CONFIG=idekey=netbeans-xdebug (Windows)
(注意:我没有测试 Windows 命令。您可能必须转义
=
字符,否则该命令可能看起来像如果是这样的话,我希望有人能在评论中纠正我。)说明:当您打开通过 Apache 运行的脚本的调试会话时,NetBeans 会将您的浏览器打开到以“<”结尾的 URL。代码>XDEBUG_SESSION_START=netbeans-xdebug”。发生这种情况时,Xdebug 知道拦截此参数并为您的浏览器提供一个包含此调试会话信息的 cookie。
上面的命令相当于在命令行环境中设置cookie。
To debug a command-line script, export the
XDEBUG_CONFIG
variable first, like so:export XDEBUG_CONFIG="idekey=netbeans-xdebug"
(Unix/Linux/OS X)set XDEBUG_CONFIG=idekey=netbeans-xdebug
(Windows)(Note: I did not test the Windows command. You may have to escape the
=
character, or the command may look a bit different. If that's the case, I hope someone comes along and corrects me in a comment.)Explanation: When you open a debugging session for a script that runs through Apache, NetBeans will open your browser to a URL that ends with "
XDEBUG_SESSION_START=netbeans-xdebug
". When this happens, Xdebug knows to intercept this argument and give your browser a cookie with this debug session information.The command above is the equivalent for setting the cookie in the command line environment.
当您说您在 Netbeans 中定义了一个断点并且它正常运行时,您是在谈论从 Netbeans 内部运行单元测试,还是运行一个在 Netbeans 中触发断点的 Web 应用程序?
不管怎样,我的第一个猜测是这两个场景使用不同的 PHP.INI 文件。让你的一个单元测试来转储配置信息,我敢说你很快就会看到。找到在命令行上使用的 PHP.INI,并确保针对该场景设置了 XDebug。
我希望这是有道理的。我现在完全不喝咖啡了。
When you say you define a breakpoint in Netbeans and it breaks fine, are you talking about running the unit tests from within Netbeans, or running a web application that triggers the breakpoints in Netbeans?
Either way, my first guess would be that the two scenarios are using different PHP.INI files. Get one of your unit tests to dump configuration information and you'll see pretty quickly I daresay. Find the PHP.INI that's being used on the command line and make sure that XDebug is set up for that scenario.
I hope that makes sense. I'm entirely coffee-free at the moment.
我不使用 netbeans,但我不认为 netbeans 会修改您放置断点的文件,而且我不认为 symfony 可以读取您的 netbean 配置来找出断点。
另外,如果您在 netbeans 内运行测试所有任务并期望测试文件中断,我认为这不会起作用,因为我相信该任务分叉了 php 进程,并且这些进程将无法被 netbeans 读取。
当然都是假设。
I don't use netbeans but I don't think netbeans modifies the file you put break points in and I don't think that symfony can read your netbean configuration to find out where to break.
Also if you are running the test all task inside netbeans and expect the test files to break I don't think that will work either as the task forks php processes I believe and these processes won't be readable by netbeans.
All hypothesis of course.