Is there a way to reach 100% file coverage with PHPUnit in PhpStorm?

If I have 2 files, 1 class and 1 interface. The class is covered at 100%, and the interface is obviously, not covered. Phpstorm Coverage shows it as 100% lines covered, and 50% files covered.

Is there any way to specify to not count certain files (Interfaces, Exceptions, php files in config directories, etc?) to reach the 100% file covered? It even counts the test directories as files not covered!

6 comments
Comment actions Permalink

Hi there,

This problem does not REALLY has relation to PhpStorm -- IDE only shows what coverage data was generated/collected by actual PHPUnit -- PhpStorm does not collect those figures itself.

"Read the manual Luke!"
https://phpunit.de/manual/current/en/index.html


You can:

0
Comment actions Permalink

I have a phpunit.xml file and I skip the files from being covered, however, they still show as (0% files) in the project browser. that is what messes the statistics.

0
Comment actions Permalink

You mean -- it shows "(0% files)" for folders but not for files?

Yes -- that is an IDE issue and it is annoying.

0
Comment actions Permalink

In this example, The Exceptions and Interfaces are skipped, even by phpunit.xml, but it shows that it has 40% files (When it should be 100%).
Is this the IDE issue? If so, is there a ticket open to fix this?



Attachment(s):
Screen Shot 2014-09-18 at 2.21.11 PM.png
0
Comment actions Permalink

Well ... screenshot is technically correct: 40% of files (2 out of 5) in that folder are covered; 100% of lines in those 2 files are covered.

That's how IDE displays coverage info for all languages (AFAIK).

If you want to change that (e.g. so that file count will include only files with coverage data) then yes -- submit Feature Request ticket to the Issue Tracker

0

Please sign in to leave a comment.