我的Symfony包的PHPUnit codecoverage不起作用

时间:2015-08-31 13:57:24

标签: symfony phpunit

当时在自制框架中创建了一个工具,并为此设置了PHPUnit的单元测试(whitout Symfony)。然后我可以使用codecoverage whitout问题进行测试。

现在我将我的工具迁移为Symfony包。我现在可以测试它没有错误(whitout codecoverage)

我用谷歌搜索并没有发现任何关于 CodeCoverage.php未定义的通知问题。

phpunit -c app src/myVendor/myBundle/

..............................................................  62 / 139 ( 44%)
.............................................................. 124 / 139 ( 89%)
...............
Time: 14.5 seconds, Memory: 45.00Mb
OK (139 tests, 5733 assertions)

但是当我为codecoverage添加日志配置时,执行将崩溃。 但在我将工具迁移到捆绑包之前,它才有用。

<phpunit bootstrap="bootstrap.php.cache"
         stopOnError="true"
         stopOnFailure="true"
         stopOnRisky="true"
         stopOnIncomplete="true"
         stopOnSkipped="true"
>
    <logging>
        <log    type="coverage-html"
                target="C:/Users/FPI/Desktop/PHPUnit_CodeCoverage/html"
                lowUpperBound="35"
                highLowerBound="70"/>
        </logging>
</phpunit>

我收到了这个错误:

Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Notice: Undefined offset: 4658' in phar://C:/bin/phpunit/php-code-coverage/CodeCoverage.php on line 694

Symfony\Component\Debug\Exception\ContextErrorException: Notice: Undefined offset: 4658 in phar://C:/bin/phpunit/php-code-coverage/CodeCoverage.php on line 694

Call Stack:
   34.3818   45467848   1. Symfony\Component\Debug\ErrorHandler->handleException() D:\Projekte\myproject\vendor\symfony\symfony\src\Symfony\Component\Debug\ErrorHandler.php:0

感谢您提供帮助。 PHPUnit v 4.6.9。 PHP 5.5.26。

1 个答案:

答案 0 :(得分:1)

感谢@Jean,PHPUnit更新解决了这个问题。

相关问题