title: PHPUnit Code Coverage & Exceptions
body: <p>I suspect PHPUnit is showing that 1 line of code is not covered by unit tests because of exceptions thats thrown (but I caught)</p>
  
  <p><a href="https://imgur.com/Q8Fry.jpg" rel="noreferrer"> <img src="https://imgur.com/Q8Fry.jpg" alt=""> </a></p>
  
  <p>I have unit test that should cover that line</p>
  
  <pre><code>/**
   * @expectedException Doctrine\ORM\NoResultException
   */
  public function testCannotLoginInvalidUser() {
  
    $user = User::login($this-&gt;em, 'nonExistant', 'password');
    $this-&gt;assertNull($user);
  
  }
  </code></pre>
  
  <p>Why is my code coverage still reflecting that is not covered? </p>
  
  <p>I did a test ... added echo b4 returning null ... I found that that line is really not covered ... </p>
  
  <pre><code>try {
    $user = $query-&gt;getSingleResult();
  } catch (Exception $e) {
    echo 'caught exception';  &lt;-- this does not get executed. 
    return null;
  }
  </code></pre>
  
  <p>Is PHPUnit skipping all execution once an exception is thrown?</p>
  
  <p><strong><em>UPDATE</strong>: I got a feeling that I am using <code>@expectedException</code> wrong tho ...</em></p>