PHPUnit in PhpStorm. Everything working great, but why do I have this error?
The Framework shown in red, and the IDE error says:
Undefined namespace Framework.
How to get rid of it ?
Phpunit introduced the namespace PHPUnit\Framework\TestCase with Version 6, early 2017 (see https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-6.0.0).
Check your PhpStorm settings, probably you configured a version prior to 6.0.0, so PhpStorm doesn't know that namespace.
I had the same error. using phpunit.phar file
I fixed adding the file as External library screenshot
I have several versions of phar so I just selected "exclude phar from project" in the other files.
Framework?File | Invalidate Caches...and restart IDE; 2) Do you have actually a PHPUnit (source files) in your project? It has to be either PHAR or Composer-installed version. 3) Have a look at this tutorials in case if you have not seen them yet: confluence.jetbrains.com/display/PhpStorm/…