windows PHPUnit 命令行工具不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5614204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHPUnit Command Line Tool Not working
提问by Felipe Almeida
I run XAMPP on windows.
我在 Windows 上运行 XAMPP。
I've recently downloaded PHPUnit from the PEAR CLI tool.
我最近从 PEAR CLI 工具下载了 PHPUnit。
Everything looks fine, (eclipse correctly suggests code completion so it means that it was correctly added to the include_path),butwhenever I try and get it to work via console by typing phpunit
(it's in the environmental PATH variable), it hangs on for a seconds or two and then closes( as if it was terminated).
一切看起来都很好,(eclipse 正确地建议了代码完成,因此这意味着它已正确添加到 include_path),但是每当我尝试通过控制台通过键入phpunit
(它在环境 PATH 变量中)使其工作时,它就会挂起秒或两秒然后关闭(好像它被终止了)。
I've tried phpunit --help
also, and no success.
我也试过phpunit --help
,没有成功。
Also tried phpunit --verbose
.
也试过了phpunit --verbose
。
Has anyone else had that same problem or knows the solution?
有没有其他人遇到过同样的问题或知道解决方案?
回答by Gordon
Make sure your PEAR is up do date:
确保你的 PEAR 是最新的:
pear upgrade-all
Do the above until it says nothing to "upgrade-all" then reinstall PHPUnit
执行上述操作,直到它对“全部升级”没有任何提示,然后重新安装 PHPUnit
pear install --alldeps --force phpunit/PHPUnit
If this doesnt fix the error, make sure you have all error reporting enabled in your php.ini and check your error logs.
如果这不能解决错误,请确保在 php.ini 中启用了所有错误报告并检查错误日志。
If this doesn't work, consider using PHPUnit via Composer or Phar instead of PEAR
如果这不起作用,请考虑通过 Composer 或 Phar 而不是 PEAR使用PHPUnit
回答by taco
For Debian or Ubuntu, add this to your PHP ini file:
对于 Debian 或 Ubuntu,请将其添加到您的 PHP ini 文件中:
suhosin.executor.include.whitelist="phar"