Is there a way to disable code coverage in PHPUnit for a single test?(有没有办法为单个测试禁用 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 中的代码覆盖率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:有没有办法为单个测试禁用 PHPUnit 中的代码覆盖率?


基础教程推荐
- 将变量从树枝传递给 js 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- Web 服务器如何处理请求? 2021-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- php中的foreach复选框POST 2021-01-01
- php中的PDF导出 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01