Search code examples
phpunitphpstorm

PHPUnit autocomplete in PhpStorm doesn't work


I cant autocomplete PHPUnit assert methods in PhpStorm 2016.3.2

When I type $this->ass there is no autocomplete. If I just type ass I can the whole list and when I autocomplete assertEquals for example I get self::assertEquals()

With CTRL + Click he brings the PHPUnit class up with all the methods -- so PhpStorm finds PHPUnit.

I don't quite get whats the problem here. Has anybody got an idea?


Solution

  • That is rather correct: assertEquals is a static method and should not really be called via $this-> way. Such behaviour is new for PhpStorm 2016.3 (or 2016.2) -- it was requested by IDE users.

    You may just press Ctrl + Space one more time and IDE will list all possible options, even static methods for $this->.


    At the same time -- it should work for PHPUnit methods (as per WI-32530 ticket).

    If it does not -- try File | Invalidate Caches... and restart IDE then -- it works just fine here (as seen on screenshot below):

    enter image description here