PHPUnit 覆盖现在不完整,因为类的左大括号没有被覆盖

标签 php symfony1 doctrine code-coverage phpunit

大家好,我一直在使用 PHPUnit 对我正在处理的 Symfony/Doctrine 项目进行单元测试。直到昨天,各种类别的覆盖率从 100% 下降到 98-99% 之前,它一直运行良好。更改的原因是因为某些原因不再将这些类的左左大括号视为“覆盖”。这是问题的屏幕截图:

http://imgur.com/RCDzm.png

我已经尝试了所有方法,但我无法弄清楚是什么原因导致某些类出现此问题,而其他类则显示“完整”覆盖范围很好。这比任何事情都更让人烦恼,因为测试仍然运行得很好,但很高兴知道发生了什么。我使用的是 PHP 5.3.2、PHPUnit v3.4.15 和 Xdebug v2.1.0,以防出现差异。

最佳答案

可能与

有关

Sebastian 在 PHPUnit 中将它标记为 wontfix,Derick 说这不是一个错误。

This is not a bug. Xdebug can only scans items (files, functions, methods) when they are loaded and code coverage is enabled. The class file is loaded before code coverage is enabled, and is therefore not picked up in the coverage report. The methods are scanned when they are run as well, so it works there.

关于PHPUnit 覆盖现在不完整,因为类的左大括号没有被覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3294358/

相关文章:

php - 在 Symfony 1.4 中的每个 Action 后执行代码

php - Doctrine2 导致网站速度变慢

php - 如何在php中压缩html输出?

php - 显示文本和/或图像而不是数据库结果

php - 从类中的函数获取具有特定内容的变量

php - Symfony - 创建插件需要什么?

symfony1 - 如何在 Symfony 中创建动态菜单

Symfony2.存储库方法不返回多对多的额外字段(外键)

php - Symfony 和 Doctrine 使迁移无效

java - Web 服务器上的 Jar 文件错误