简体   繁体   English

PHPStorm和VM单元测试

[英]PHPStorm and VM unit tests

I'm trying to setup remote tests execution and debugging in PHPStorm following those two articles from JetBrains: 我正在尝试根据JetBrains的这两篇文章在PHPStorm中设置远程测试执行和调试:

I'm working in PHPStorm 9.0.2 on Windows 8.1, and my VM is Debian Jessy sitting inside Virtual Box v 4.3.26. 我正在Windows 8.1上的PHPStorm 9.0.2中工作,我的VM是坐在Virtual Box v 4.3.26中的Debian Jessy。 VM is connected to host OS via host-only interface. VM通过仅主机接口连接到主机OS。 Host machine has IP 192.168.10.1 and guest one has IP 192.168.10.2. 主机具有IP 192.168.10.1,来宾计算机具有IP 192.168.10.2。

My problem so far is remote interpreters in PHPStorm, ie if I do: 到目前为止,我的问题是PHPStorm中的远程解释器,即如果我这样做:

  1. Go to PHPStorm setting 转到PHPStorm设置
  2. Find Languages & Frameworks -> PHP 查找Languages & Frameworks -> PHP
  3. See Interpreter option and click the ... button to open the interpreters Window. 请参阅Interpreter选项,然后单击...按钮以打开解释器窗口。
  4. Specify my connection settings as on attached screenshot 指定我的连接设置,如附件屏幕截图所示
  5. If I press button 1, then PHPStorm shows a choose-folder dialog which corresponds to server file structure and I can actually choose the right path to php executable there. 如果按按钮1,PHPStorm将显示​​一个与服务器文件结构相对应的选择文件夹对话框,我实际上可以在其中选择php可执行文件的正确路径。 PHP is indeed located at /usr/bin/php . PHP确实位于/usr/bin/php
  6. If I press button 2, then dialog 3 appears and stays on the screen forever. 如果按按钮2,则对话框3出现并永远停留在屏幕上。 The only way to get rid of it is to kill network connection or kill PHPStorm. 摆脱它的唯一方法是杀死网络连接或杀死PHPStorm。 PHPStorm PHP解释器窗口

I tried googling the issue, but failed to find anything related. 我尝试使用Google搜索该问题,但未找到任何相关内容。 My private key file is in PuTTY *.ppk format. 我的私钥文件为PuTTY * .ppk格式。 My user has permissions to write and read from project folder, though it is not the same user as apache uses. 我的用户具有写和读项目文件夹的权限,尽管它与apache使用的用户不同。

If I go to Tools -> Start SSH session then PHPStorm starts a terminal session using provided credentials, ie it doesn't seem to be a SSH connection issue, rather smth else. 如果我转到Tools -> Start SSH session则PHPStorm使用提供的凭据启动终端会话,即,这似乎不是SSH连接问题,而是其他问题。

Would be great to get any hint on this issue. 希望得到关于该问题的任何提示。

Looks like I spotted the issue. 看起来我发现了问题。 Problem is that I was initially trying to run unit tests from the console and expecting PHPStorm to stop on breakpoints inside unit-tests. 问题是,我最初试图从控制台运行单元测试,并期望PHPStorm在单元测试中的断点处停止。 This was not happening, but PHPStorm was stopping before the first line of code of the PHPUnit.phar file, and sadly that continued to happen. 这没有发生,但是PHPStorm在PHPUnit.phar文件的第一行代码之前停止了,可悲的是这种情况仍在继续。 Ie when PHPStorm validates the php setup it seem to execute some php command and that command is either waiting for ages till other php thread get released or gets suspended before it's first line execution. 即,当PHPStorm验证php设置时,它似乎在执行一些php命令,并且该命令或者等待一段时间直到其他php线程被释放,或者在执行第一行之前被挂起。

So, I restarted PHPStorm, deactivated listening to xdebug connections and things started to work as they should according to JetBrains docs mentioned in the question. 因此,根据问题中提到的JetBrains文档,我重新启动了PHPStorm,停用了监听xdebug连接的操作,一切开始按预期进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM