简体   繁体   English

如何运行存储在应用程序目录中而不是PHP目录中的单元测试?

[英]How do I run unit tests stored in my application directory as opposed to in the PHP directory?

I've just installed PHPUnit and wrote a quick class which I saved to C:\\PHP and it worked fine. 我刚刚安装了PHPUnit,并编写了一个快速的类,将该类保存到C:\\ PHP,并且工作正常。 If however I move the php file containing the test class to the tests directory of my application, it returns the error Class firstTest could not be found in .. 但是,如果我将包含测试类的php文件移到我的应用程序的tests目录中,它将返回错误在..中找不到Class firstTest的错误。

How do I resolve the problem such that it can see the class in the application test directory? 我该如何解决该问题,使其可以在应用程序测试目录中看到该类?

检查您的配置文件,并确保已给出测试目录的正确路径。

Thanks for the response - it wasn't the solution I used, but it led me to research that produced an alternative. 感谢您的答复-不是我使用的解决方案,但它使我进行了研究,找到了替代方案。

What I did was to add my PHP directory (C:\\PHP) to the PATH environment variable. 我所做的是将我的PHP目录(C:\\ PHP)添加到PATH环境变量中。 This allowed me to call phpunit from the tests directory of my application. 这使我可以从应用程序的tests目录中调用phpunit。

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

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