phpunit + Symfony2:没有消息指定哪些测试失败

时间:2016-09-04 12:56:04

标签: php symfony phpunit

当我运行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。

我会贬低任何其他的消息或提示。

1 个答案:

答案 0 :(得分:0)

只是为了记录,也许它可以帮助某人作为解决方法,使用  phpunit -c app src/yourVendor/yourBundle/Tests/
将显示失败的每条路径失败的失败消息。