I suspect PHPUnit shows that 1 line of code does not apply to unit tests due to exceptions that were thrown (but I caught)

I have a unit test that should cover this line
public function testCannotLoginInvalidUser() {
$user = User::login($this->em, 'nonExistant', 'password');
$this->assertNull($user);
}
Why does my code coverage still reflect what is not covered?
I did a test ... added echo b4, returning null ... I found that this line really is not covered ...
try {
$user = $query->getSingleResult();
} catch (Exception $e) {
echo 'caught exception'; <-- this does not get executed.
return null;
}
Is PHPUnit skipping all execution after throwing an exception?
The UPDATE . I got the feeling that I'm using the @expectedExceptionwrong tho ...
source
share