title: phpunit mock a method that should return an exception
body: <p>I have a method in a class that parses some xml.
  If it finds the tag <strong>&lt; status >failure&lt; /status ></strong>, it returns an exception.</p>
  
  <p>I want to build a unittest that checks this method does return an exception when the status=failure.</p>
  
  <p>For the moment, I fail to get it done using <strong>phpunit</strong> and <strong>MOCKING</strong>?</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;?php
  $mock = $this-&gt;getMock('Service_Order_Http', array('getResponse'));
          $mock-&gt;expects($this-&gt;any())
              -&gt;method('getResponse')
              -&gt;will($this-&gt;throwException(new Exception()));
  
          $e = null;
          try {
              $mock-&gt;getResponse();
          } catch (Exception $e) {
  
          }
          $this-&gt;assertTrue($e instanceof Exception, "Method getResponse should have thrown an exception");
  
  //phpunit sends back: PHPUnit_Framework_ExpectationFailedException : Failed asserting that exception of type "Exception" is thrown.
  ?&gt;
  </code></pre>
  
  <p>Thanks for your help</p>