简体   繁体   English

无论我在哪个目录,如何在Windows命令行中运行phpunit命令?

[英]How do I run phpunit command in Windows command line no matter what directory I am in?

all examples of phpunit I saw run the simple command line tool: phpunit的所有例子我看到运行简单的命令行工具:

phpunit TestClass phpunit TestClass

but when I try the same on a directory other than the xampp php dir, I end up getting an "unknown command..." 但是当我在xampp php目录以外的目录上尝试相同的操作时,我最终得到了一个“未知的命令......”

Is there a way to execute the phpunit command from any directory in the Windows command line? 有没有办法从Windows命令行中的任何目录执行phpunit命令?

Add the phpunit to your System PATH 将phpunit添加到您的系统路径

Setting Path on Windows Start -> Control Panel -> System -> Advanced Click on Environment Variables, under System Variables, find PATH, and click on it. 在Windows上设置路径 - >控制面板 - >系统 - >高级单击“系统变量”下的“环境变量”,找到“路径”,然后单击它。 In the Edit windows, modify PATH by adding the location of the class to the value for PATH. 在“编辑”窗口中,通过将类的位置添加到PATH的值来修改PATH。 If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value. 如果您没有PATH项,则可以选择添加新变量并将PATH作为名称和类的位置添加为值。 Close the window. 关上窗户。 Reopen Command prompt window, and run phpunit TestClass 重新打开命令提示符窗口,然后运行phpunit TestClass

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

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