Improve handling of coverage exclude option on PHPUnit 11+ by marcovtwout · Pull Request #6937 · Codeception/Codeception · GitHub
Skip to content

Improve handling of coverage exclude option on PHPUnit 11+ - #6937

Merged
TavoNiievez merged 3 commits into
Codeception:mainfrom
marcovtwout:patch-2
Jun 14, 2026
Merged

TavoNiievez merged 3 commits into
Codeception:mainfrom
marcovtwout:patch-2

Conversation

@marcovtwout

Copy link
Copy Markdown
Contributor

In #6739 the exclude option for running coverage on PHPUnit11+ was reimplemented by @Naktibalda

The alternative implementation (function newWhiteList()) creates a regression when running on Windows with a config like:

coverage:
  enabled: true
  include:
    - application/foo/*.php
  exclude:
    - application/foo/bar/*

The array_diff() compares files between both file lists based on string paths which may not use exactly the same formatting. In the case above, files in bar are not excluded because when comparing paths they partially contain \ instead of / as a directory separator.

This PR improves the compare function looking at normalized real paths.

Create the difference list based on the real file paths to account for platform specific handling (such as Windows sometimes using \ instead of / ) or relative path differences
@TavoNiievez
TavoNiievez merged commit 0dcff3e into Codeception:main Jun 14, 2026
9 of 10 checks passed
@marcovtwout
marcovtwout deleted the patch-2 branch August 27, 2026 09:38
@marcovtwout
marcovtwout restored the patch-2 branch August 27, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants