photo credit: Vintage Lightbulb via photopin (license)

How to enable PHPUnit code completion in PhpStorm

Tags: ,

So you’ve got PhpStorm and you’re writing your tests with PHPUnit. But how do you get the code completion to work?

Screen Shot 2015-04-22 at 08.29.02
Well, the solution is very simple:

Download phpunit.phar

If you haven’t done this already, you need to download the phpunit.phar file from phpunit.de, and save it somewhere on your computer.

Set up an interpreter

The next thing you need to do is set up an interpreter for your project. You can do this by navigation to “Settings > Languages & Frameworks > PHP” and select an Interpreter from the dropdown. The dropdown is populated by interpreters found on your system. If you don’t see any, or you want to add one, you can use the button with the “…” next to the dropdown to locate the PHP binary on your system. On OSX, PHP comes with the system and is located in /usr/bin/php :

Screen Shot 2015-04-22 at 08.31.58
Also don’t forget the add the path to your phpunit.phar  file to the include path list.


That’s it! You can now enjoy code completion when writing your PHPUnit tests in PhpStorm.

Screen Shot 2015-04-22 at 08.32.46

Visitors give this article an average rating of 3.5 out of 5.

How would you rate this article?

Leave a Reply