La cobertura del código phpUnit en las interfaces no muestra éxito

Currently I am doing a whitebox test so the parent class and all interfaces are tested. This covers them all so I add the doc comment:

 * @covers \Pat\Environment\PHP\Autoloader\Psr0<extended>
public function testWhitebox() {}

phpUnit runs with success but the interface does not appear in the coverage.xml file. No matter if excluded or not.

<?xml version="1.0" encoding="UTF-8" ?>
<phpunit bootstrap="bootstrap.php">

        <log type="coverage-clover" target="./coverage.xml"/>

The phpStorm IDE keeps counting it as file and therefor it is missing. Without that issue it would be 100% code coverage.

Code coverage in phpStorm

It is open for phpStorm and fixed for IntelliJ IDEA.

¿Alguna solución alternativa?

preguntado el 05 de mayo de 13 a las 10:05

How to cover something that doesn't even exist? Cobertura es un cobertura de código. And you (by definition) don't have any implementations to test in interfaces. -

Well it counts as a file and that is missing in the XML. Then it is up to phpStorm or PHPUnit. -

I'm not sure I properly understand the question. Interfaces contain no executable code. How do you want to test them? What should be covered? -

Also please add the commandline how you invoke PHPUnit to the question to add some more context. -

I think you misinterpret the summary given next to the directory. It is perfectly correct to say 66% of the files are code-coveraged (it shows that there are some files that can not be covered at all for examples). As you can see, it says 100% of the lines. That value is important in your case. Not the file-percentage. -

1 Respuestas

¿Cómo arreglar eso?

If this qualifies as a bug/flaw/new feature request in PHPStorm, you can report it as an issue in their issue tracker for PHPStorm (and other products).

Their personnel will then take care to fix that.

If you do not want to go that route, you can just ignore the file in your code-coverage statistics because you don't need to take it into account when calculating the percentage.

contestado el 23 de mayo de 17 a las 13:05

Thanks. It is solved in IntelliJ but not solved for phpStorm. I saw the force discussion but this didn't work (see new information above). Still counting every file. - LeMike

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.