Repository navigation
Conversation
…t directory Since phpunit/php-code-coverage 14, `--coverage-php` writes the file keys relative to `basePath`. When the covered files share only the root directory (e.g. /tmp/x/A.php and /home/y/B.php), the path reducer returns an empty base path and the keys lose their leading separator, so they no longer match the real paths of the mutated files: every mutation becomes uncovered and `--covered-only` skips the files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs `--mutate` with and without `--covered-only` for a class generated in the temporary directory and covered together with a class of the repository. Skipped on Windows, where the file finder takes the paths with a drive letter for relative paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
Description:
When the covered files share only the root directory, every mutation is reported as uncovered, and
--covered-onlycreates no mutation at all. This happens, for example, with one source directory under/tmpand another under/home.Since phpunit/php-code-coverage 14,
--coverage-phpwrites the file keys relative to abasePathcomputed byPathReducer. When the only common ancestor is/,PathReducerstrips it from every key and returns an emptybasePath.MutationTestRunner::run()restores the paths only whenbasePath !== '', so the keys stay relative (home/runner/...). They then match no mutated file, which is looked up by its real path.Windows is not affected the same way. Files on the same drive get a
basePathsuch asC:, and files on different drives have no common ancestor and keep their absolute paths. That is why this only shows on Linux and macOS.The fix. The restoring moves to
CoveragePaths::restore():basePathis prepended as before;basePath, a path starting with a drive letter stays as is;Tests.
tests/Unit/Support/CoveragePathsTest.phpreduces the paths withPathReducerexactly as--coverage-phpdoes and checks that they are restored. It covers a single file, files sharing a directory, and files sharing only/, plus a same-drive and a different-drives case that only run on Windows.tests/Features/CoveragePathsTest.phprunspest --mutateend to end with a covered class in the system temporary directory, outside the repository. It expects the mutations to be tested, with and without--covered-only.CI. The workflows ran on a fork with the full matrix and
fail-fast: false.COMPOSER_ROOT_VERSION=5.x-devwas set there only because Composer cannot guess the root version of a feature branch. The results were compared, job by job, with the same workflows on unmodified5.x(d0c8711):prefer-lowest: 324 passed, 2 skipped (the Windows-only cases);5.x: Tests, Static Analysis —prefer-lowest: 319 passed.Apart from the new tests, the set of failures is identical in every job:
Tests\Visual\*snapshots fail in theprefer-stablejobs, because current PHPUnit prints a deprecation warning for thecacheResultattribute ofphpunit.xml;🤖 Generated with Claude Code