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 兼容。但是,我没有降级,而是设法以这种方式修补了框架本身。

  1. 转到/plugins/php/lib

  2. 备份 PHP.jar

  3. 使用您必须打开文件的任何工具,通常是zip或其他压缩工具或在ubuntu文件滚筒下。

  4. 转到脚本/phpunit.php

  5. 修改它,搜索"IDE_PHPUnit_Framework_TestListener"类并在那里添加以下行:

公共函数 addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {}

  1. 保存文件并更新 PHP.jar