【问题标题】:Different results when running PHPUnit from commandline than from netbeans从命令行运行 PHPUnit 时的结果与从 netbeans 运行时的结果不同
【发布时间】:2014-06-29 15:21:08
【问题描述】:

我有一个测试

    $response=$this->call('GET', '/');
    $this->assertResponseOk();

当我运行 Symfony\Component\HttpKernel\Exception\NotFoundHttpException 时失败

phpunit

从项目目录中的命令行,我在项目目录中有 phpunit.xml(来自 laravel)

但是当我从 Netbeans 运行测试时 - 它通过了。

我将 Netbeans 输出命令复制到命令行

phpunit "C:\Program Files\NetBeans 8.0\php\phpunit\NetBeansSuite.php" "--run=C:\Program Files (x86)\wamp\www\platform\workbench\neyl\customers\tests;C:\Program Files (x86)\wamp\www\platform\app\tests"

它也有效!

因此,当从 NetbeansSuite.php 调用而不是从常规命令行调用时,测试有效。 甚至

phpunit MyTest.php

失败

怎么会这样?使用 PHPUnit_Framework_TestSuite 与普通 cli 有什么不同?

【问题讨论】:

  • 这个问题可能是phpunit版本不同造成的。
  • 如前所述,我正在通过 cli 调用路径中找到的 phpunit.bat 复制 Netbeans 测试套件,因此这两个测试肯定使用相同的版本!

标签: netbeans laravel-4 phpunit netbeans-8


【解决方案1】:

好的。差异是由调用订单测试引起的。 来自 cli 的 phpunit 使用来自 phpunit.xml 的测试套件,但 netbeans 测试不使用 phpunit.xml 作为测试套件,因此它们被调用以 netbeans 调用它们的顺序

现在我必须弄清楚测试类的顺序导致了什么!

【讨论】:

    猜你喜欢
    • 2019-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多