Cannot find PHPUnit in include path phpstorm

前端 未结 7 1638
-上瘾入骨i
-上瘾入骨i 2021-01-31 16:19

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

7条回答
  •  你的背包
    2021-01-31 16:27

    For future readers, to fix the same issue when using PHPStorm + Vagrant + PHPUnit by defining path to the global phpunit.phar (not composer)

    While the tests runned successfully, I was missing the code completion. I had confirmed that phpunit was in the PATH on my local machine, and to make sure, I had added /usr/local/bin to the PHP Include paths in PHP Settings. Still no code completion.

    The reason: PHPstorm was looking for phpunit.phar, not just phpunit. To fix, on my local machine I established a symlink phpunit.phar pointing to phpunit:

    $ cd /usr/local/bin/
    $ sudo ln -s phpunit phpunit.phar
    

    Then I reindexed the project, and code completion started working.

提交回复
热议问题