【发布时间】:2015-11-25 14:15:27
【问题描述】:
在那些日子里,在自制框架中制作了一个工具,并为此使用 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
感谢您的帮助。 PHPUnit v 4.6.9。 PHP 5.5.26。
【问题讨论】:
-
你能把 PHPUnit 更新到最新版本吗?您是否将覆盖范围列入了严格的最小文件范围?