phpunit从命令行运行返回"'phpunit'不被识别为内部或外部命令,可操作程序或批处理文件."

Wil*_*ill 8 php windows phpunit windows-7

当我phpunit在命令行上运行时,我得到了'phpunit' is not recognized as an internal or external command, operable program or batch file.

php已被添加到我的系统路径中.我的php.ini包括include_path=".;C:\PHP\pear".

如何通过命令行识别命令phpunit?

Gor*_*don 11

确保您的PEAR安装已正确安装并在Windows环境中可用.每个PEAR命令在PEAR安装目录中都有一个相应的.bat文件,例如phpunit.bat.因为这些是在命令行上执行例如phpunit时调用的文件,所以此目录也必须在您的PATH上.仅在include_path上具有PEAR目录是不够的.

如果您确定PEAR已正确安装.重新安装PHPUnit

pear install --alldeps --force phpunit/PHPUnit 
Run Code Online (Sandbox Code Playgroud)