I'm now trying for hours to setup PhpStorm for unit testing. Whatever I do, I get this
Process finished with exit code 1
Cannot find PHPUnit in include path ...
PHPUnit is (via command line) accessible from anywhere; I've set the correct include path and have added PHPUnit to the external libraries. No chance.
Is it possible at all or does it only work with installations via PEAR? I've worked through all related questions here, am on Mac and PHPUnit is running smoothly via CLI.
@aderuwe's answer works but that config isn't scoped per project, it's for all projects. Since PHPStorm 6 (actually even EAP version PS-126.260
) you can do the following:
File
-> Settings
-> PHP
-> PHPUNIT
.Use custom loader
and then enter the autoload.php
file from your projects vendor directory. This autoloader will autoload all the dependencies managed by Composer (including PHPUnit).phpunit.xml.dist
from your project's app
directory).That needs to be repeated per project, but the following needs to be done once.
You need to configure you defaults in PHPStorm correctly.
Run
-> Edit Configurations...
or just click the dropdown menu on the toolbar and select Edit Configurations...
.Defaults
-> PHPUnit
Test Scope
, select Defined in configuration file
Interpreter options
textfield is emptyPHPUnit
(above Defaults
) and delete any entry under it (so that next time you a test on a particular file, etc. it'll set up a new one but using the new default).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