Search code examples
phpunitphpstorm

Phpunit error in PhpStorm


I am running tests in PhpStorm and I get this error. Does anyone know what on earth could be causing it?

PHP Fatal error: Class 'PHPUnit_TextUI_ResultPrinter' not found in C:\Users\administrator1\AppData\Local\Temp\ide-phpunit.php on line 249

I run tests in other projects - that also utilise ide-phpunit.php and they run just fine.


Solution

  • Silly mistake on my part... simply forgot to add phpunit as a dependency in the project. For anyone else that gets this error, to composer.json add:

    "require-dev": {
        "phpunit/phpunit": "3.7.*"
    },
    

    And then run:

    composer update
    

    That solved the problem.