dongsheng8664 2014-08-20 08:14
浏览 177
已采纳

在PhpStorm IDE上使用PHPUnit

I've developed a simple test class usign PHPUnit on my PhpStorm IDE.

  • PHP version: 5.4.25
  • PHPUnit version 4.2.1
  • MAMP 3.0.2
  • PHPStorm 7.1

This is the configuration of my IDE:

enter image description here

enter image description here

And this is my Test class:

namespace test\controllers;


class AuthTest extends \PHPUnit_Framework_TestCase {

    protected function setUp() {
        parent::setUp(); // TODO: Change the autogenerated stub
        echo "start";
    }

    protected function tearDown()
    {
        parent::tearDown(); // TODO: Change the autogenerated stub
        echo "end";
    }


    public function testProva() {
        $tot = 5;

        $this->assertEquals($tot, 5);
    }
}

EDIT:

This is the configuration of my test run:

enter image description here

When I Run the class (class name: AuthTest, file name: AuthTest.php) I obtain the following error: Process finished with exit code 255 But when I run the same class by command line phpunit path/test/folder/ it works fine.

What is wrong?

  • 写回答

1条回答 默认 最新

  • dqmdlo9674 2014-08-20 10:01
    关注

    PhpStorm v7.x does not support PhpUnit 4.x (only 3.6 ..or maybe 3.7 MAX).

    PhpStorm uses special helper/wrapper script for integration purposes (so that IDE receives test progress/results in understandable format (much-much easier that parsing PHPUnit native output, which does not provide much details needed for IDE)). This wrapper in PhpStorm v7.x does not support PHPUnit v4.x.

    For PhpUnit 4.x support you should try v8 EAP build (or wait for v8 official release -- 1-2 months from now, approximately).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题