The message:
No filter is configured, code coverage will not be processed
from PHPUnit 10.5 means that PHPUnit is trying to generate code coverage reports, but you haven't configured which files or directories should be included in the code coverage filter. Without this configuration, PHPUnit skips code coverage collection.
Why does this happen?
PHPUnit requires you to specify which source code files should be included in the code coverage analysis. This is usually done in the phpunit.xml configuration file under the <filter> section.
How to fix it?
- Create or update your
phpunit.xml file (usually in your project root):
Make sure you have a <filter> section that includes the directories or files you want to measure coverage for.
Example:
<phpunit ...>
<coverage processUncoveredFiles="true">
<include>
<directory>src</directory>
</include>
</coverage>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
Note: In PHPUnit 10, the <whitelist> tag has been deprecated and replaced by <include> inside <coverage>. So the correct modern config looks like:
<phpunit ...>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
Make sure to replace src with the directory where your source code lives.
- Run PHPUnit with coverage enabled
Make sure you run PHPUnit with the --coverage-text or --coverage-html option, for example:
phpunit --coverage-text
or
phpunit --coverage-html coverage-report
Summary
- Add a
<coverage> section with <include> specifying your source code directory in phpunit.xml.
- Run PHPUnit with coverage options.
- This will configure the filter and enable code coverage processing.
If you want, I can help you generate a minimal phpunit.xml file for your project if you provide your source directory structure.