I suspect PHPUnit is showing that 1 line of code is not covered by unit tests because of exceptions thats thrown (but I caught)
I have unit test that should cover that line
/**
* @expectedException Doctrine\ORM\NoResultException
*/
public function testCannotLoginInvalidUser() {
$user = User::login($this->em, 'nonExistant', 'password');
$this->assertNull($user);
}
Why is my code coverage still reflecting that is not covered?
I did a test ... added echo b4 returning null ... I found that that line is really not covered ...
try {
$user = $query->getSingleResult();
} catch (Exception $e) {
echo 'caught exception'; <-- this does not get executed.
return null;
}
Is PHPUnit skipping all execution once an exception is thrown?
UPDATE: I got a feeling that I am using @expectedException wrong tho ...
Application\Models. Does it being in a namespace change anything?