我的 Symfony 包的 PHPUnit codecoverage 不起作用

PHPUnit codecoverage of my Symfony bundle does not work

在那些日子里,在自制框架中制作了一个工具,并为此设置了 PHPUnit 的单元测试(没有 Symfony)。然后我可以使用代码覆盖率进行测试而不会出现问题。

现在我将我的工具迁移为 Symfony 包。我现在可以毫无错误地测试它(无代码覆盖)

我用谷歌搜索,但没有找到任何关于 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)

但是当我为代码覆盖添加日志记录配置时,执行会崩溃。 但是在我将我的工具迁移到一个包中之前它起作用了

<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

感谢您的帮助。 PHP单位 v 4.6.9。 PHP5.5.26.

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