PHPUnit 不适用于 IntelliJ Idea 13.1.3

PHPUnit does not work with IntelliJ Idea 13.1.3

我在将 Idea 13.1.3 与 PHPUnit 4.5.0 结合使用时遇到以下异常。在其他一些线程中,我看到这是一个错误,但我认为这似乎也是最新版本的问题。

Testing started at 17:06 ...

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 /private/var/folders/yc/cc0z8db95hx4l_d0fvtrx2yxsjjh3x/T/ide-phpunit.php on line 504

Call Stack:
0.0014 854704 1. {main}() /private/var/folders/yc/cc0z8db95hx4l_d0fvtrx2yxsjjh3x/T/ide-phpunit.php:0

Variables in local scope (#1):
$PHPUnitVersionId = *uninitialized*

Process finished with exit code 255

从 IntelliJ 论坛发现 IntelliJ 13 只兼容 PHPUnit 3.x。 但是,我没有降级,而是设法在 this way.

中暂时修补了框架本身
  1. go to /plugins/php/lib

  2. make a backup of php.jar

  3. Use whatever tool you have to open the file, usually zip or other compress tools or under ubuntu the file roller.

  4. Go to scripts/phpunit.php

  5. Modify it, searching for the "IDE_PHPUnit_Framework_TestListener" class and adding there the following line:

public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {}

  1. save the file and update the php.jar