<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 18 May 2013 22:23:17 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHP Developer Blog: Unit Tests: How to test for Exceptions]]></title>
      <guid>http://www.phpdeveloper.org/news/12374</guid>
      <link>http://www.phpdeveloper.org/news/12374</link>
      <description><![CDATA[<p>
The PHP Developer Blog has <a href="http://www.phpdevblog.net/2009/04/unit-tests-how-to-test-for-exceptions.html">a quick post</a> for the unit testers out there on how to work with exception handling in your tests.
</p>
<blockquote>
When unit testing, you'd also want to test whether your application throws Exceptions as expected (the following examples are based on SimpleTest). Assumption for the examples is, that we have a method that expects an integer as parameter.
</blockquote>
<p>
Putting the assertion inside of the catch block won't work correctly since it wouldn't happen unless an exception is thrown. Instead he recommends putting it right after the exception try/catch and check to see if the exception variable is a type of 'Exception' (with another potential solution of adding in a check for an 'InvalidArgumentException').
</p>]]></description>
      <pubDate>Mon, 20 Apr 2009 12:06:15 -0500</pubDate>
    </item>
  </channel>
</rss>
