4
votes

I am trying to run some PHPUnit 6 tests in PhpStorm. These are my configurations.

Copies the .phar file to my machine following instructions in here. And now, I can verify my version, enter image description here

I have configured PHP7 in PhpStorm enter image description here

But, I cannot seem to create PHPUnit 6 tests in the IDE. When I try to autocreate templates (new->phpunit), the templates have the pre PHPUnit 6 format enter image description here

I tried to create the tests manually as well, but PhpStorm cannot find the PHPUnit 6 classes. I have PhpStorm pointing to the phpunit phar file. enter image description here

I am in a fix here.

PhpStorm also complains the class PHPUnit_Framework_TestCase can't be found. So I can't work with the new PHPUnit or the old one.

Am I missing something?

1
"Am I missing something?" Yes -- the fact that PhpStorm does not support PHPUnit 6 yet. Support should be added for 2017.1 . Template can be altered at Settings/Preferences | Editor | File & Code Templates - LazyOne
"So I can't work with the new PHPUnit or the old one." PhpStorm still works fine with PHPUnit 5 (using it on daily basis). Get phpunit.phar for PHPUnit 5 (download form PHPUnit website) .. or install it using Composer. - LazyOne
The main thing that has changed in PHPUnit 6 (simply speaking; in regards to how this integration works in PhpStorm) is that now all PHPUnit classes are namespaced (PHPUnit\Framework\TestCase vs PHPUnit_Framework_TestCase) and PHPUnit support in PhpStorm is relying on presence of PHPUnit_Framework_TestCase class (e.g. to recognize such file as a test case etc). - LazyOne
youtrack.jetbrains.com/issue/WI-34957 -- watch this ticket (star/vote/comment) to get notified on any progress. - LazyOne
@LazyOne I get the point and I was able to work with PHPUnit 5 in PhpStorm. Thanks a lot! - Nikhil Kuriakose

1 Answers

0
votes

PHPUnit 6 support is currently available in the PhpStorm 2017.1 EAP,l which you can run alongside your regular installation.

Article with more details

Download