The best solution I've found is to patch your IntelliJ installation with a manual fix. These instructions assume Linux paths, but the same basic process should be possible on Windows.
Find the JAR
First, find the php.jar
file in your IntelliJ installation. JAR files are a kind of ZIP file, you can open (and modify) both of them with the same tools. On my system, it was present at:
/home/username/.IntelliJIdea12/config/plugins/php/lib/php.jar
Make a backup of php.jar
, since we're going to edit it.
Extract the template
Using a popular ZIP-file tool (like 7-Zip) open php.jar
, and find the compresesd file inside called:
scripts/phpunit.php
Extract this file to a temporary location where you can edit it.
Add the method to the template
Inside the file, we need to find the class IDE_PHPUnit_Framework_TestListener
, which in my case is around line 303
. On that class, we need to add a new method:
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time){}
Save the file when you are done.
Update the JAR with the new template
Now overwrite scripts/phpunit.php
inside the JAR with your new version. Depending on your ZIP tool, this might have been as easy as double-clicking the file to open it, saving your changes, and clicking a confirmation prompt, but it depends on what you're using.
Restart IntelliJ
Now you should be done! Running, debugging, or generating code-coverage data with PHPUnit should be just a convenient click of a button.
Note that if you update your PHP plugin, it will probably overwrite the fix and you'll need to re-apply it again.