Interfaces and empty classes in code coverage

I am using PHPUnit 5.2.9, PHP 5.6.19 and Xdebug 2.4.0 (without RC), as well as the netbeans IDE.

Like any other project, I use interfaces and an odd empty extended class. Since these files do not contain executable code, why are they listed in my code coverage reports? Moreover, they are listed as 0% covered by 0/0 methods. (I would be happy if it were 100% to see fewer reds)

I tried to exclude them in the file phpunit.xml:

<whitelist processUncoveredFilesFromWhitelist="false"> // true make no difference
    <directory suffix=".php">./Annotation</directory>
    <directory suffix=".php">./Cache</directory>
    <exclude>
        <directory suffix=".php">./*Interface</directory>
        <directory suffix=".php">./*/*Interface</directory>
    </exclude>
</whitelist>

But it seems that globs (*) are only valid for directories. However, I can use the tag <file>and exclude them separately. However, there are many files to exclude when they should not be included in the first place.

Am I doing something wrong or is this standard behavior?

+4
1

:

<exclude>
    <directory suffix="Interface.php">.</directory>
</exclude>

OTherwise, , , :

<?php
/**
 * @codeCoverageIgnore
 */
interface Foo
{
    public function bar();
}

, . . :

 /**
 * @test
 * @covers Bar::foo
 * @covers BarInterface::foo
 */
  public function foo()
  {
    ....
  }

+3

All Articles