如何从另一个目录运行 PHPUnit 测试
我在 Windows PC 上的 c:\kim\test\HelloTest.php 中有一个非常简单的 PHPUnit 测试。我可以使用以下命令从 c:\kim\test 目录中执行它:
phpunit HelloTest
问题是我无法从任何其他目录执行它。
据我所知,我应该能够从 c:\kim 目录执行此命令:
phpunit test
另外,我认为以下语法也可以工作:
phpunit c:\kim\test
但我没有从命令中得到任何响应。只是一个空行,然后我就返回到光标处。
我正在尝试让单元测试与 Netbeans 一起正常工作,我想我需要首先解决这个问题。也许它与路径有关?有什么想法吗?
I have a very straightforward PHPUnit test in c:\kim\test\HelloTest.php on a Windows PC. I can execute it from within the c:\kim\test directory with the command:
phpunit HelloTest
The problem is that I can't execute it from any other directory.
As far as I know I should be able to execute this from the c:\kim directory with:
phpunit test
Also, I would have thought the following syntax would work too:
phpunit c:\kim\test
But I don't get any response from the command. Simply a blank line and then I am returned to the cursor.
I am trying to get unit tests working properly with Netbeans and I think I need to solve this problem first. Perhaps it has something to do with paths? Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据上面的评论,我花了很长时间试图解决这个问题。还尝试重新安装 PHPUnit。最后我运行了一台新服务器,安装了 XAMPP,一切正常。
I spent quite a while trying to sort this out, per the comments above. Also tried reinstalling PHPUnit. In the end I ran up a new server, installed XAMPP, and all works fine.
如果有帮助的话。
我正在使用 eclipse 的 makegood 扩展,它可以一键处理 phpunit 测试执行。
也许你可以找到类似的 Netbeans 扩展或切换到 eclipse
If any help.
I am using makegood extension for eclipse which handle phpunit test execution with one click.
Maybe you can find similar extension for Netbeans or switch to eclipse