I’m currently working on Bitcoin Payment Bundle for Symfony2. You can view it on my github. It is not (yet, I hope) fully test-driven developed but I try to make it as test-covered as possible.
Bundle contains the AbstractCommand class that implements the CommandInterface interface. Because it is an abstract class, it doesn’t need to implement every of interface’s methods. Great.
Next, I have the AbstractCommandTest test case. It tests that validateParameters method works well. Test covers every line of the class. But…when I run test-coverage analysis on my IDE (IntelliJ Idea with PHP Plugin) it shows that coverage is magic 93%. This is doubly strange because no line is marked with red color (I’ve changed default color scheme, so I see it well 😉 ).
Question is: why?
Is it PHPUnit bug? Or maybe it is class-model construction issue? When I had abstract methods inside AbstractCommand (and no interface) they were also not covered.
I’ve resolved that issue when looked into the clover coverage file. It shows:
When you look at the AbstractCommand file, line 36 is a blank line after the class definition. Removing it causes the coverage to be 100%. I think this is the IntelliJ’s/PHPStorm’s issue.