You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of PHPUnit 9.3, PHPUnit started using PHP-Parser as a basis to calculate code coverage. PHP Parser also polyfills tokens and that can interfere with the sniffs, but also with the code coverage runs.
PHPUnit has also added a new feature in PHPUnit 9.3.4 to warm the code cache ahead of running tests recording code coverage. Using that feature should prevent the token interference.
Notes regarding cache-warming:
* The `--coverage-cache` and `--warm-coverage-cache` options are available since PHPUnit 9.3.4 and if these are used on older PHPUnit versions, PHPUnit will error out with an "unrecognized CLI argument" error.
* In other words: these options can only be used with PHPUnit 9.3+, which is why the PHPUnit version is checked and remembered and subsequently used in the conditions.
* Also: running PHPUnit with the `--warm-coverage-cache` option _does not run the tests_. It literally only warms the cache, which is why this is implemented as a separate step in the workflow.
* The cache directory can be configured in the `phpunit.xml[.dist]` file, but only when using the PHPUnit 9.3+ `coverage` XML tag.
As the PHPUnit config used needs to stay cross-version compatible with older PHPUnit versions, the CLI option is used for now.
Refs:
* sebastianbergmann/php-code-coverage#798 (comment)
* sebastianbergmann/phpunit@9.3.3...9.3.4
0 commit comments