本文介绍了有没有办法为单个测试禁用 PHPUnit 中的代码覆盖率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我在 PHPUnit 中运行一个单元测试时,也会生成一个代码覆盖率报告.我有一台旧电脑在工作,如果我可以在不需要它时禁用代码覆盖,那对我的 CPU 的压力就会更小.

Every time I run a single unit test in PHPUnit, a code coverage report is also generated. I have an older computer here at work, and if I could disable the code coverage when I don't need it, that would put less strain on my CPU.

有没有办法在每个测试的基础上禁用代码覆盖?我找不到任何可以执行此操作的命令行开关.

Is there a way to disable the code coverage on a per-test basis? I couldn't find any command-line switch that would do it.

推荐答案

如何制作一个 phpunit.xml 的副本,从中删除 <logging> 节,然后执行以下操作:

How about making a copy of your phpunit.xml, removing the <logging> stanza from it, then doing:

phpunit --configuration new.xml

这篇关于有没有办法为单个测试禁用 PHPUnit 中的代码覆盖率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 20:07