Reputation: 613
I'm using PHPUnit (3.6.7) to test and provide code coverage reports on my application, everything is set-up and working as expected.
I have complete coverage for all of the code except for my interfaces, even though I have tests that for classes that implement the interfaces. The report just states that the interface was not executed
Is there a way to cover the interfaces? Or is it a case of telling PHPUnit to ignore them for code coverage?
Upvotes: 9
Views: 2482
Reputation: 62395
You can specify that tests for a concrete class cover methods from parent abstract classes/interfaces.
See Specifying Covered Methods
section in Code Coverage Analysis chapter in the manual.
In the same chapter you'll also find ways to ignore blocks of code or entire files from code coverage analysis.
Upvotes: 5
Reputation: 38981
Just as an additional answer:
The next release of PHPUnit (3.7.
) will ignore all interfaces for coverage by default.
So it will not necessary to use any sort of includes or //@codeCoverageIgnore
ways to work around then.
Upvotes: 5
Reputation: 31770
Interfaces contain no executable code, so there's nothing there to test.
Upvotes: 1