【问题标题】:PHPUnit does not work with IntelliJ Idea 13.1.3PHPUnit 不适用于 IntelliJ Idea 13.1.3
【发布时间】:2015-03-16 11:41:39
【问题描述】:

在使用带有 PHPUnit 4.5.0 的 Idea 13.1.3 时出现以下异常。在其他一些线程中,我看到这是一个错误,但我这似乎也是最新版本的问题。

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

【问题讨论】:

  • IDEA 是 Java IDE。大多数编写 PHP 的人都使用 WebStorm。
  • @duffymo 我知道,但我正在使用 PHP 插件。
  • 听起来你的代码和 PHP 框架不匹配;有人在框架中添加了一个新的抽象方法。那是你的吗?这是代码问题,不是 IDE 问题。
  • @duffymo 没有 PHPUnit 不是我的

标签: php unit-testing intellij-idea phpunit


【解决方案1】:

从 IntelliJ 论坛发现 IntelliJ 13 只兼容 PHPUnit 3.x。 然而,我没有降级,而是设法在this way 中修补了框架本身。

  1. 转到 /plugins/php/lib

  2. 备份php.jar

  3. 使用任何工具打开文件,通常是 zip 或其他压缩工具,或者在 ubuntu 下使用文件滚轮。

  4. 转到scripts/phpunit.php

  5. 修改它,搜索“IDE_PHPUnit_Framework_TestListener”类并在其中添加以下行:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-28
    • 1970-01-01
    • 2014-08-08
    • 2020-04-23
    • 1970-01-01
    • 2022-08-05
    • 1970-01-01
    • 2014-05-13
    相关资源
    最近更新 更多