What does code coverage line% on directories mean?

Hi all.

When running a code coverage test on a single file, the percentage of lines covered given on the parent directories of the tested file don't make sense to me, so I was wondering what it refers to.

For example, I test one file, and the file itself has 100% lines coverage. There are several other files in the same directory not part of the code coverage, and I've verfied manually that there isn't any other file in the folder that has a code coverage stat next to it. The PHPUnit test being run has @covers tags, that specify in all cases a method in that one file to perform code coverage on, so there definitely shouldn't be any other files included in the code coverage.

The parent folder of the tested file is reported as 6% files, 53% lines. The 6% files makes sense, but I don't get where the 53% lines is coming from. I would have thought it should be 100% also, as in 6% of files covered, and of those files, 100% lines are covered, but clearly it's not behaving that way.

And it doesn't seem to refer to the percentage of all lines in all files in the folder, as there is no way that one file represents 53% of all the lines of all files in that folder. So I can't work out where the 53% is coming from. It's as if it's including some files in the folder not part of the code coverage, but not all of them. I don't see on what basis.

Am I missing something? What exactly is this percentage meant to be showing?

I tried to track down the phpunit coverage xml file that PhpStorm uses, but couldn't work out where it's located. I'm using v6.

Please sign in to leave a comment.