Warm tip: This article is reproduced from serverfault.com, please click

unit testing-使用带有 --coverage 的 PCOV 时,Codeception 测试失败

(unit testing - Codeception tests fail when using PCOV with --coverage)

发布于 2021-01-28 16:18:42

我的单元/功能测试有问题。我使用的是 PHP 7.2、PHPUnit 8.5 和 Codeception 4.1。我的测试在正常运行时运行良好,但出于某种原因,如果我尝试使用 PCOV 为功能或单元测试生成代码覆盖率,它们会立即停止,没有任何警告或错误输出。

vendor/codeception/codeception/codecept --ansi run unit --phpunit-xml --no-exit --coverage-xml
Codeception PHP Testing Framework v4.1.16
Powered by PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

Test.unit Tests (1080) --------------------
MBP145:prjct patrick.barbosa$

当我使用 xdebug 而不是 PCOV 时,我能够运行测试并生成覆盖率而不会遇到任何问题。

有谁知道什么可能导致这种情况?

Questioner
patrick.barbosa.3979
Viewed
0
patrick.barbosa.3979 2021-02-25 19:32:59

对于遇到类似问题的任何人,我找到了解决方案。

在 PHP 7.2 中使用 PCOV 运行测试时,Opcache 似乎会导致问题,禁用它可以解决问题,现在测试运行良好。