I'm developing a PHP5 program using IDEA 13.1. Of course I want to cover my code using some Unit tests.
I installed phpunit via aptitude and upgraded it to 4.0.11 using pear.
Somehow IDEA seems unable to detect the installed PHPUnit... The class PHPUnit_Framework_TestCase is marked as undefined. The documentation on https://www.jetbrains.com/idea/webhelp/enabling-phpunit-support.html wants me to include either the pear directory (which does not exist) or the phpunit.phar (which does not exist, either).
So far most things went smooth with IDEA so I'm surprised that something as fundamental as setting up PHPUnit does not work :-(
Ok, after some fiddling around I got to a working solution. I downloaded phpunit-lts.phar from phpunit.de and put it directly into the project (along with the other files... meh).
Do not use the most current version (4.0 as of 21st of march 2014) of PHPUnit! Versions beyond 3.7 (or 3.8, as it seems) are not supported by IDEA or PHPStorm. You will get
PHP Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in /tmp/ide-phpunit.php on line 504
So do yourself a favor and stick to the LTS version for now.
Another solution:
Set
"phpunit/phpunit": "3.7"
in composer.json
and run
composer update
Then the issue will be resolved.