为什么不调用PHPUnit代码覆盖率报告功能? [英] Why won't PHPUnit code coverage report functions that aren't called?

查看:57
本文介绍了为什么不调用PHPUnit代码覆盖率报告功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获得我的一个项目的代码覆盖率,但是未被调用的函数和类不会影响覆盖率计算。当忽略大块代码时,很难看到尚未涵盖的内容(很多)。

I'm trying to get code coverage on one of my projects, but functions and classes that aren't called don't factor into the coverage calculations. It's hard to see what isn't covered yet (lots) when large chunks of code are ignored.

在下图中,我希望前三个的内容功能以红色突出显示。至少在执行功能中未执行的行至少显示为红色。

In the image below, I would expect the bodies of the first three functions to be highlighted red. Lines that aren't executed in functions that do get executed show up red, at least.

对于它的价值,我正在运行Debian Testing,它安装了apt安装的PHP 7.0.12-1和XDebug 2.4.1-1,并使用了Composer安装的PHPUnit 4.8.27。

For what it's worth, I'm running Debian Testing with PHP 7.0.12-1 and XDebug 2.4.1-1 as installed by apt and using PHPUnit 4.8.27 as installed by Composer.

推荐答案

这似乎是XDebug和PHP 7.0的一个持续存在的错误,如本问题所述: https://github.com/sebastianbergmann/php-code-coverage/issues/411 因此,应该可以按照我的预期工作,并且我的设置没有任何不妥。猜猜我只需要等待直到找到并修复了根本原因(在XDebug中)。在此之前,该线程注意到打开进程隔离是一种解决方法。

This appears to be an ongoing bug with XDebug and PHP 7.0, as covered in this issue: https://github.com/sebastianbergmann/php-code-coverage/issues/411 So, it should be working as I expect and there's nothing incorrect about my setup. Guess I'll just have to wait until the underlying cause (in XDebug) is found and fixed. Until then, the thread notes that turning on process isolation is a work-around.

这篇关于为什么不调用PHPUnit代码覆盖率报告功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆