I'm trying to generate coverage html file with PHPUnit. I get a warning: 'No filter is configured, code coverage will not be processed' and coverage file isn't generated.
This is phpunit.xml file
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./phpUnitTutorial</directory>
</testsuite>
</testsuites>
</phpunit>
Can anyone help?
I suggest you use the configuration generator (phpunit --generate-configuration
). It will ask you a couple of questions and then generate the right configuration for you.
I added the following to my PHPUnit 9.5 configuration file between the <phpunit>
tags:
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With