Sometimes IntelliJ IDEA has problems running, debugging, or showing code-coverage for PHPUnit tests. This can occur when the classes it generates are not compatible with the version of PHPUnit you have.
In my case, it's IntelliJ IDEA 12.1.6 versus PHPUnit 4.0.14, which always fails with this message:
/usr/bin/php /tmp/ide-phpunit.php --configuration /home/username/Documents/stuff/phpunit.xml.dist
Testing started at 5:32 PM ...
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 496
PHP Stack trace:
PHP 1. {main}() /tmp/ide-phpunit.php:0
Process finished with exit code 255
The code it is generating in /tmp/ide-phpunit.php
does not contain a new method required by PHPUnit 4.x.
Things which I've tried that don't work:
- Fixing the file manually and marking it read-only causes IntelliJ to stop and complain that it cannot replace the file.
- Setting up a "run-before" command to automatically patch the file is insufficient, because it doesn't seem to work for debugging nor code-coverage, only regular runs.