title: symfony2 phpunit : how to get exception message when status code is not expected one
body: <p>With my symfony 2 application, i am using phpunit to test if each controller's action response's status code is the expected one.</p>
  
  <p>When not, how can I have phpunit display the error message that comes with the exception, or best, simulate a profiler exception page ?</p>
  
  <p>The reason for this is I have an action returning a 500 code in phpunit but which loads just fine in my browser.</p>
  
  <p>My code :</p>
  
  <pre><code>/**
   * @dataProvider urlProvider
   * @param $url
   */
  public function testPageIsSuccessful($url)
  {
      $client = self::createClient(array(), array(
              'PHP_AUTH_USER' =&gt; 'superadmin',
              'PHP_AUTH_PW'   =&gt; '587010',
          ));
      $client-&gt;followRedirects();
      $client-&gt;request('GET', $url);
      var_dump($url);
      $this-&gt;assertEquals(200, $client-&gt;getResponse()-&gt;getStatusCode());
  }
  </code></pre>
  
  <p>Thanks !</p>