I am trying to use PHPUnit with PhpSTORM by loading it from autoloader file. But, as you can see in the below screenshot, PHPUnit version: is not installed, i am getting the same even if i choose other two options. i.e. Path to phpunit.phar and Load from include path(PEAR).
here is what i get when i run a test case:
PhpUnit classes and code autocompletion is being detected but PhpStorm editor just fine.
First go to Settings -> Languages and Frameworks -> PHP and Add a remote interpreter, then go to Settings -> Languages and Frameworks -> PHP -> PHPUnit click the + on top and click by Remote Interpreter . If you're using Composer autoloader, then enter your full Vagrant path to your autoloader file.
To verify PHPUnit has been installed type phpunit --version in command prompt. You should get something like PHPUnit x.y.z by Sebastian Bergmann and contributors.
PHPUnit is a unit testing framework for the PHP programming language. It is an instance of the xUnit architecture for unit testing frameworks that originated with SUnit and became popular with JUnit. PHPUnit was created by Sebastian Bergmann and its development is hosted on GitHub.
If this happens and you see the red I with PHPUnit Version not installed then you probably get the message "Please select PHP Interpreter to load PHPUnit version" when you press the refresh button.
If you have the path to phpunit.phar
set and your path the composer autoloader is fine, then it is possible that PHPStorm simply doesn't get what PHP exe file to use to load the PHPUnit.
You can then choose to add a Remote PHP Interpreter but you may also choose to add a local PHP Interpreter (for instance if you have XAMPP or WAMPP or LAMPP installed on your computer).
Press Ctrl+Alt+S and go to -> Languages & Frameworks -> PHP -> CLI Interpreter -> go for the button with the dots (or shift + enter) and there you can add an "Interpreter" by pressing the + button.
I added my own local interpreter xampp\php\php.exe
Press apply and okay and go back to
Languages & Frameworks -> PHP -> Test Frameworks and go for the refresh button.
It should do some magic and then it will say PHPUnit version: 6.5 (or whichever you installed).
I had my local (XAMPP) Apache server running.
For anyone running into this in 2020 and also if you have problem with Docker container mapping, Path Mapping stay same if you select your Project root in Docker container option:
Just add double slash at your host path: //, looks like this is bug in PHPStorm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With