<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to Unit-Test for Expected Exception Thrown in Simpletest - *The* Answer</title>
	<link>http://www.eatmybusiness.com/food/2010/01/16/how-to-test-for-expected-exception-thrown-in-simpletest-the-answer/139/</link>
	<description>Web Publishing Techniques</description>
	<pubDate>Tue, 07 Feb 2012 21:05:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>

	<item>
		<title>By: Ewald</title>
		<link>http://www.eatmybusiness.com/food/2010/01/16/how-to-test-for-expected-exception-thrown-in-simpletest-the-answer/139/#comment-19401</link>
		<author>Ewald</author>
		<pubDate>Thu, 29 Sep 2011 10:46:35 +0000</pubDate>
		<guid>http://www.eatmybusiness.com/food/2010/01/16/how-to-test-for-expected-exception-thrown-in-simpletest-the-answer/139/#comment-19401</guid>
					<description>To copy the full behaviour of expectException, you should define another catch:

try{
$something-&#62;generateSpecificException();
$this-&#62;fail('no exception was thrown');
} catch (SpecificException $e) {
$this-&#62;pass();
} catch (Exception $e) {
$this-&#62;fail('An exception was caught, but not of the expected type');
}</description>
		<content:encoded><![CDATA[<p>To copy the full behaviour of expectException, you should define another catch:</p>
<p>try{<br />
$something-&gt;generateSpecificException();<br />
$this-&gt;fail(&#8217;no exception was thrown&#8217;);<br />
} catch (SpecificException $e) {<br />
$this-&gt;pass();<br />
} catch (Exception $e) {<br />
$this-&gt;fail(&#8217;An exception was caught, but not of the expected type&#8217;);<br />
}</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: John</title>
		<link>http://www.eatmybusiness.com/food/2010/01/16/how-to-test-for-expected-exception-thrown-in-simpletest-the-answer/139/#comment-19403</link>
		<author>John</author>
		<pubDate>Fri, 30 Sep 2011 06:20:17 +0000</pubDate>
		<guid>http://www.eatmybusiness.com/food/2010/01/16/how-to-test-for-expected-exception-thrown-in-simpletest-the-answer/139/#comment-19403</guid>
					<description>Ewald. I generally avoid having too many types of Exception floating about as it can get messy. 

So, that was not in my mind when I wrote the piece. But, yes, if type is important, it makes total sense to add that extra catch. Thanks for the suggestion.</description>
		<content:encoded><![CDATA[<p>Ewald. I generally avoid having too many types of Exception floating about as it can get messy. </p>
<p>So, that was not in my mind when I wrote the piece. But, yes, if type is important, it makes total sense to add that extra catch. Thanks for the suggestion.</p>
]]></content:encoded>
				</item>
</channel>
</rss>

