dongyin6576 2013-08-19 09:15
浏览 636
已采纳

在include path phpstorm中找不到PHPUnit

Cannot find PHPUnit in include path is the error message I get when I try to run my code in phpstorm.

In the PHP Settings, my PHP level language is 5.4 (traits, short array syntax, etc.) and interpreter is Name(5.4.7) where Name is user defined.

The error appears when I try to run the code and the exact message is this:

C:\xampp2\php\php.exe C:\Users\DELL\AppData\Local\Temp\ide-phpunit.php --no-configuration

C:\xampp2\htdocs\ft-website

Testing started at 2:34 PM ...

Process finished with exit code 1

Cannot find PHPUnit in include path (.;C:\xampp2\php\PEAR)`

  • 写回答

6条回答 默认 最新

  • doutian3010 2014-03-25 20:11
    关注

    Just encountered this problem myself.

    I'm unsure why it is unable to find PHPUnit in the include path (despite the fact that it is there, albeit in all lowercase).

    I got around this by changing my IntelliJ Preferences for PHPUnit (under PHP --> PHPUnit). I changed the PHPUnit library settings to Use custom loader and then specified the path to the phpunit executable. On my mac, that was /usr/local/Cellar/php54/5.4.26/bin/phpunit.

    UPDATE:

    I just discovered that pear now installs PHPUnit as a phar named phpunit. It previously installed the PHPUnit source, which was really nice for reference and code completion in PHPStorm. I think that this is the reason things aren't working any longer with PHPStorm, because it's expecting a php executable and not a php archive.

    So, I'm moving away from using pear to install PHPUnit, and I'm using composer instead. This bundles PHPUnit directly as a dependency of my project, which makes it more portable than a system dependency. You'll need to add vendor/phpunit/phpunit as a PHP include path in your PHPStorm preferences. This will serve two purposes:

    1. PHPStorm can find the phpunit executable now
    2. PHPStorm will index all the PHPUnit classes now, so you'll get auto-complete. Yay!

    To do this, go to Languages and Frameworks in the PhpStorm settings. If you click on PHP, on the right you have your include paths

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能