使用除 xdebug 之外的其他代码覆盖率驱动程序 [英] Use other code coverage driver than xdebug
问题描述
我想使用 pcov 而不是 xdebug 用于代码覆盖率生成.
I want to use pcov instead of xdebug for code coverage generation.
我正在使用 Docker 并且安装了 xdebug.
I'm using Docker and I have xdebug installed.
如果我运行以下命令,我可以确定 xdebug 不会影响测试执行吗?
Can I be sure that xdebug won't affect test execution if I run the following command?
php -d xdebug.default_enable=0 -d pcov.enabled=1 path/to/phpunit --coverage-text
我读到 pcov 可能更快 但据我所知 xdebug 必须被禁用.
I read that pcov might be faster but as I understood xdebug has to be disabled.
为了获得最快的覆盖率,是否最好执行以下操作而不是运行上述命令?
Is it better do the following to achieve the fastest coverage instead of running the above command?
- 删除/截断 xdebug 配置
运行测试
- remove/truncate xdebug config
run tests
php -d pcov.enabled=1 path/to/phpunit --coverage-text
恢复 xdebug 配置
restore xdebug config
推荐答案
Xdebug 和 PCOV 都重载了引擎的相同部分,因此它们不兼容,作者试图使它们兼容是没有意义的.
Xdebug and PCOV both overload the same parts of the engine, as a result they are incompatible, and there's no sense in the authors trying to make them compatible.
如果您想使用 PCOV 作为 php-code-coverage 的驱动程序,则必须不加载 Xdebug .
Xdebug must not be loaded if you want to use PCOV as the driver for php-code-coverage.
来源:我写了 pcov ...
这篇关于使用除 xdebug 之外的其他代码覆盖率驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!