<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Testing with CakePHP 1.2 &#8211; A preview</title>
	<atom:link href="http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:12:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Lista.lu &#8211; de la start la private beta &#124; Dream Production</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-164610</link>
		<dc:creator>Lista.lu &#8211; de la start la private beta &#124; Dream Production</dc:creator>
		<pubDate>Tue, 08 Jun 2010 12:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-164610</guid>
		<description>[...] teste (adica, facem TDD &#8211; Test Driven Development), trecem pe cararea mai putin oficiala a modulului cu simpleTest pentru ca cel oficial si inca in beta are un caz pe care nu merge si nu reusim sa gasim cauza in [...]</description>
		<content:encoded><![CDATA[<p>[...] teste (adica, facem TDD &#8211; Test Driven Development), trecem pe cararea mai putin oficiala a modulului cu simpleTest pentru ca cel oficial si inca in beta are un caz pe care nu merge si nu reusim sa gasim cauza in [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Kulak</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-125220</link>
		<dc:creator>Doug Kulak</dc:creator>
		<pubDate>Fri, 10 Apr 2009 15:01:11 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-125220</guid>
		<description>@cakebaker: Thanks for the quick response!  I&#039;m relieved to hear that the CakePHP community is on top of things :)</description>
		<content:encoded><![CDATA[<p>@cakebaker: Thanks for the quick response!  I&#8217;m relieved to hear that the CakePHP community is on top of things :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-125219</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Fri, 10 Apr 2009 14:48:28 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-125219</guid>
		<description>@Doug: Thanks for your comment!

No, this test suite is outdated, and so I recommend to use the official test suite which is bundled with CakePHP. 

Hope that helps, and happy testing :)</description>
		<content:encoded><![CDATA[<p>@Doug: Thanks for your comment!</p>
<p>No, this test suite is outdated, and so I recommend to use the official test suite which is bundled with CakePHP. </p>
<p>Hope that helps, and happy testing :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Kulak</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-125169</link>
		<dc:creator>Doug Kulak</dc:creator>
		<pubDate>Fri, 10 Apr 2009 03:55:23 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-125169</guid>
		<description>Is this still the best way to test CakePHP?  I&#039;m brand new to unit testing and want to be sure I&#039;m off on the right track!</description>
		<content:encoded><![CDATA[<p>Is this still the best way to test CakePHP?  I&#8217;m brand new to unit testing and want to be sure I&#8217;m off on the right track!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-105629</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sat, 06 Sep 2008 17:14:55 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-105629</guid>
		<description>@Richard: Well, you can replace the render() method in testable_controller.php with:
&lt;code&gt;
function render($action = null, $layout = null, $file = null) {
    $this-&gt;viewContent = parent::render($action, $layout, $file);
}
&lt;/code&gt;
In your test method you can then access the view content with:
&lt;pre&gt;
&lt;code&gt;
$this-&gt;controller-&gt;viewContent;
&lt;/code&gt;
&lt;/pre&gt;
Hope that helps!</description>
		<content:encoded><![CDATA[<p>@Richard: Well, you can replace the render() method in testable_controller.php with:<br />
<pre><code>function render($action = null, $layout = null, $file = null) {
    $this-&gt;viewContent = parent::render($action, $layout, $file);
}</code></pre><br />
In your test method you can then access the view content with:</p>
<pre>
<code>$this-&gt;controller-&gt;viewContent;</code>
</pre>
<p>Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Yumul</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-105420</link>
		<dc:creator>Richard Yumul</dc:creator>
		<pubDate>Fri, 05 Sep 2008 04:44:04 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-105420</guid>
		<description>Is there a way to make cake produce the same resulting HTML when run under the testsuite versus what cake produces when an action is hit thru the web server? 

I&#039;d like to be able to capture the output.  In other words, I&#039;d like to be able to be able to capture the output when an action is executed from the testsuite, and that ideally should be the same HTML returned when the action is executed when hit thru the web server.  Does that make sense?

&lt;code&gt;
class FooTest extends CakeTestCase {
  function testBar() {
    $this-&gt;get(&#039;/foo/bar&#039;);
    // how do I get the HTML output now?
  }
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Is there a way to make cake produce the same resulting HTML when run under the testsuite versus what cake produces when an action is hit thru the web server? </p>
<p>I&#8217;d like to be able to capture the output.  In other words, I&#8217;d like to be able to be able to capture the output when an action is executed from the testsuite, and that ideally should be the same HTML returned when the action is executed when hit thru the web server.  Does that make sense?</p>
<pre><code>class FooTest extends CakeTestCase {
  function testBar() {
    $this-&gt;get('/foo/bar');
    // how do I get the HTML output now?
  }
}</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noi @ Dream Production &#187; Blog Archive &#187; Lista.lu - de la start la private beta</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-96324</link>
		<dc:creator>Noi @ Dream Production &#187; Blog Archive &#187; Lista.lu - de la start la private beta</dc:creator>
		<pubDate>Thu, 26 Jun 2008 09:39:40 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-96324</guid>
		<description>[...] facut teste (adica, facem TDD - Test Driven Development), trecem pe cararea mai putin oficiala a modulului cu simpleTest pentru ca cel oficial si inca in beta are un caz pe care nu merge si nu reusim sa gasim cauza in [...]</description>
		<content:encoded><![CDATA[<p>[...] facut teste (adica, facem TDD &#8211; Test Driven Development), trecem pe cararea mai putin oficiala a modulului cu simpleTest pentru ca cel oficial si inca in beta are un caz pe care nu merge si nu reusim sa gasim cauza in [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-82283</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sun, 13 Apr 2008 16:48:34 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-82283</guid>
		<description>@Richard: You have to instantiate the component and set it as property of your component, for example:
&lt;pre&gt;
public function setUp() {
    $this-&gt;myComponent = new MyComponent();
    $this-&gt;myComponent-&gt;Session = new SessionComponent();
}
&lt;/pre&gt;

@Irina: Thanks for your explanations! I will add the snippet to the code as it makes sense to show the errors. 

Regarding the post and get methods, do you think it would be better if the data have to be passed in the form &quot;data[Model][field]&quot;?</description>
		<content:encoded><![CDATA[<p>@Richard: You have to instantiate the component and set it as property of your component, for example:</p>
<pre>
public function setUp() {
    $this-&gt;myComponent = new MyComponent();
    $this-&gt;myComponent-&gt;Session = new SessionComponent();
}
</pre>
<p>@Irina: Thanks for your explanations! I will add the snippet to the code as it makes sense to show the errors. </p>
<p>Regarding the post and get methods, do you think it would be better if the data have to be passed in the form &#8220;data[Model][field]&#8220;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Irina Dumitrascu</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-2/#comment-82089</link>
		<dc:creator>Irina Dumitrascu</dc:creator>
		<pubDate>Sat, 12 Apr 2008 14:05:32 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-82089</guid>
		<description>How we mocked our components (would qualify as a slightly-soiled hack :) )

Another thing we needed for testing was to mock some components. We wanted to bypass the authentication and use a simple, fake authentication component that would pass as authenticated the user we wanted.

In order to do that we:
- hijacked cake&#039;s dispatcher class, separating the fragment that initializes the controller and starts it in a function
- in testsuite&#039;s test_dispatcher class the function was overridden, and we: 
	- added the FakeAuth component to the set of components of the controller
	- started the controller 
	- modified the pointer to the Auth component to point to our FakeAuth object, that was created when the controller was started

Please let me know if there is any less intrusive way to do this.

http://www.geocities.com/irina2000d/dispatcher.patch.txt
http://www.geocities.com/irina2000d/test_dispatcher.patch.txt</description>
		<content:encoded><![CDATA[<p>How we mocked our components (would qualify as a slightly-soiled hack :) )</p>
<p>Another thing we needed for testing was to mock some components. We wanted to bypass the authentication and use a simple, fake authentication component that would pass as authenticated the user we wanted.</p>
<p>In order to do that we:<br />
- hijacked cake&#8217;s dispatcher class, separating the fragment that initializes the controller and starts it in a function<br />
- in testsuite&#8217;s test_dispatcher class the function was overridden, and we:<br />
	- added the FakeAuth component to the set of components of the controller<br />
	- started the controller<br />
	- modified the pointer to the Auth component to point to our FakeAuth object, that was created when the controller was started</p>
<p>Please let me know if there is any less intrusive way to do this.</p>
<p><a href="http://www.geocities.com/irina2000d/dispatcher.patch.txt" rel="nofollow">http://www.geocities.com/irina2000d/dispatcher.patch.txt</a><br />
<a href="http://www.geocities.com/irina2000d/test_dispatcher.patch.txt" rel="nofollow">http://www.geocities.com/irina2000d/test_dispatcher.patch.txt</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Irina Dumitrascu</title>
		<link>http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/comment-page-1/#comment-82071</link>
		<dc:creator>Irina Dumitrascu</dc:creator>
		<pubDate>Sat, 12 Apr 2008 12:33:23 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/#comment-82071</guid>
		<description>Hi,

we&#039;ve updated the code in order to be able to put more than one record/fixture in the db. Here is the patch, if you would like to integrate it:
http://www.geocities.com/irina2000d/cake_test_case.patch.txt

It contains also the &#039;cry and die&#039; fix from the previous post :)</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>we&#8217;ve updated the code in order to be able to put more than one record/fixture in the db. Here is the patch, if you would like to integrate it:<br />
<a href="http://www.geocities.com/irina2000d/cake_test_case.patch.txt" rel="nofollow">http://www.geocities.com/irina2000d/cake_test_case.patch.txt</a></p>
<p>It contains also the &#8216;cry and die&#8217; fix from the previous post :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

