SteeveDroz
SteeveDroz

Reputation: 6146

How can I tell PHPUnit that a path is impossible to cover?

I have a program to test and it needs to have decent code coverage, including path coverage.

I still have an untested path. Here is the code:

if (0 == count($arr)) {
  return -1;
}

for ($i = 0; $i < count($arr); $i++) {
  // do something
}

PHPUnit tells me I'm missing the path where I don't enter the if and go 0 times in the for loop. You and I can see it's not possible, but how do I tell PHPUnit to ignore that path?

Upvotes: 0

Views: 16

Answers (0)

Related Questions