PHPUnit 6.5.5 和 PHP 7.2 的测试覆盖率

2022-01-25 00:00:00 code-coverage php phpunit xdebug

问题是带有switch case的行没有被覆盖,switch case本身正在被执行.

the problem is that lines with the switch case are not covered, the switch cases themselves are being executed.

在 Windows 上测试

Tested on windows

推荐答案

输出在技术上是正确的,因为 PHP 7.2 现在很聪明,不再需要运行 case 语句.我在 https://derickrethans.nl/php7.2-switch.html

The output is technically correct, as PHP 7.2 is now clever and no longer needs to run the case statements. I wrote about these optimisations at https://derickrethans.nl/php7.2-switch.html

尽管如此,这是不受欢迎的行为,因此 Xdebug 使用 https 修复了这个错误"://github.com/xdebug/xdebug/commit/0690bf83109228a67dfe14a9a312045435b7b774 — 这是 GitHub 上 Xdebug 代码的一部分,但尚未发布.它将进入 Xdebug 2.6.0beta2.

Nevertheless, this is unwanted behaviour, and hence Xdebug has this "bug" fixed with https://github.com/xdebug/xdebug/commit/0690bf83109228a67dfe14a9a312045435b7b774 — this is part of Xdebug's code on GitHub, but has not made it yet into a release. It will make it into Xdebug 2.6.0beta2.

相关文章