Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit warning - No filter is configured, code coverage will not be processed

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?

like image 531
Przemek Kro Avatar asked Sep 17 '20 14:09

Przemek Kro


2 Answers

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.

like image 77
Sebastian Bergmann Avatar answered Oct 22 '22 00:10

Sebastian Bergmann


I added the following to my PHPUnit 9.5 configuration file between the <phpunit> tags:

<coverage>
    <include>
        <directory suffix=".php">src</directory>
    </include>
</coverage>
like image 6
afilina Avatar answered Oct 21 '22 23:10

afilina