有没有办法为单个测试禁用 PHPUnit 中的代码覆盖率?

2022-01-25 00:00:00 unit-testing php 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

相关文章