- Go to
File -> Settings -> PHP -> PHPUNIT.
- Select 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).
- Specify the default configuration file (this is usually phpunit.xml.dist from your project's app directory).
@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:
Go to File -> Settings -> PHP -> PHPUNIT.
Select 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).
Specify the default configuration file (this is usually phpunit.xml.dist from your project's app directory).
PHP
-> PHPUNIT
That needs to be repeated per project, but the following needs to be done once.
You need to configure you defaults in PHPStorm correctly.
- Go to
Run -> Edit Configurations...
or just click the dropdown menu on the toolbar and select Edit Configurations.... - Go to
Defaults -> PHPUnit
- Under Test Scope, select Defined in configuration file
- Make sure the Interpreter options textfield is empty
- Go to PHPUnit (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).