So you’ve got PhpStorm and you’re writing your tests with PHPUnit. But how do you get the code completion to work?
Well, the solution is very simple:
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 :
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.
Visitors give this article an average rating of 3.5 out of 5.
How would you rate this article?
★ ★ ★ ★ ★