XDebug and PHPUnit getting code coverage wrong

I am using php 5.5.9 on Ubuntu 14.04. I updated Xdebug to the version the Wizard recommends, which is version 2.2.6, and I used apt-get to make sure my Ubuntu system is up to date. The problem, however, is that my lines of code cover lines that get executed when they are clearly not.

Here are the offensive lines:

    if(!$filter->isValid()) {
        throw new Exception\InvalidInput($this->formatFilterErrors($filter));
    }

      

I know that the conditional code inside the if statement is not executed as the filtered data is always valid. I can prove this by putting echo or stamp expressions in a block of code (above the throw statement) and they never get executed.

So why is code coverage telling me that the throw statement is being executed, many times?

While I only have one example of incorrect reporting, I really need to sort this out as a priority since I have a lot of trials for this application. I could try updating PHP (but this of course has other implications). Also, my only option is to raise, but with a developer.

Have you encountered this error? I've heard of other issues with Xdebug on Ubuntu 14.04, but the Xdebug update has cleared up their issues.

+3


source to share





All Articles