【问题标题】:phpunit + Symfony2: There is no message specifying which tests are failingphpunit + Symfony2:没有消息指定哪些测试失败
【发布时间】:2016-09-04 12:56:03
【问题描述】:

当我运行 phpunit -c app 这是输出:

PHPUnit 5.1.3 by Sebastian Bergmann and contributors.

WF.FFF..............                                              20 / 20 
(100%)

Time: 19.65 seconds, Memory: 18.00Mb

There was 1 warning:

1) Warning
No tests found in class "Sheik\RobotBundle\Tests\Controller\CrawlerControllerTest".

WARNINGS!
Tests: 20, Assertions: 21, Failures: 4, Warnings: 1.

我在 Ubuntu 16.04 中使用 Symfony 2.5。在更新到 Ubuntu 16.04 之前,每次失败都会有一条消息指出哪个测试失败了。

这是我的 app/phpunit.xml.dist:

    <?xml version="1.0" encoding="UTF-8"?>

<!-- http://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
    backupGlobals               = "false"
    backupStaticAttributes      = "false"
    colors                      = "true"
    convertErrorsToExceptions   = "true"
    convertNoticesToExceptions  = "true"
    convertWarningsToExceptions = "true"
    processIsolation            = "false"
    stopOnFailure               = "false"
    syntaxCheck                 = "false"
    bootstrap                   = "bootstrap.php.cache" >

    <testsuites>
        <testsuite name="Project Test Suite">
            <directory>../src/*/*Bundle/Tests</directory>
            <directory>../src/*/Bundle/*Bundle/Tests</directory>
        </testsuite>
    </testsuites>

    <!--
    <php>
        <server name="KERNEL_DIR" value="/path/to/your/app/" />
    </php>
    -->

    <filter>
        <whitelist>
            <directory>../src</directory>
            <exclude>
                <directory>../src/*/*Bundle/Resources</directory>
                <directory>../src/*/*Bundle/Tests</directory>
                <directory>../src/*/Bundle/*Bundle/Resources</directory>
                <directory>../src/*/Bundle/*Bundle/Tests</directory>
            </exclude>
        </whitelist>
    </filter>

</phpunit>

我尝试了其他问题中的建议: PHPUnit problem - no error messages 但 error_reporting 已设置为 E_ALL |在我的 php.ini 中将 E_STRICT 和 display_errors 设置为 On。

我会感谢任何其他建议或提示。

【问题讨论】:

  • 尝试在启用详细选项的情况下执行phpunitphpunit -v
  • --verbose 选项没有帮助。它只是将此行添加到输出中:Configuration: /var/www/newsheikit/app/phpunit.xml.dist

标签: php symfony phpunit


【解决方案1】:

仅作记录,也许它可以帮助某人解决问题,使用 phpunit -c app src/yourVendor/yourBundle/Tests/
将显示失败测试的每个路由丢失的失败消息。

【讨论】:

    猜你喜欢
    • 2014-12-28
    • 1970-01-01
    • 1970-01-01
    • 2013-10-31
    • 2013-07-28
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 2021-05-19
    相关资源
    最近更新 更多