> Hi everyone,
>
> I was taking a look at the documentation for the test suite in CakePHP
> 2.0 - more specifically the part about testing controller code:
>
> http://book.cakephp.org/2.0/en/development/testing.html#testing-contr...
>
> The code example provided in this heading doesn't include the "public
> $fixtures" line - if you just copy and paste that example, it will run
> using the default database connection instead of the test one. This
> might have been omitted to make the example simpler, but I think the
> consequences of forgetting this line are potentially very dangerous
> (you might delete or update live data accidentally!).
>
> Here's a version of the same example that uses test fixtures, thus
> causing the test suite to use the test database connection:
>
> class ArticlesControllerTest extends ControllerTestCase {
>
> public $fixtures = array('app.article');
>
> function testIndex() {
> $result = $this->testAction('/articles/index');
> debug($result);
> }
>
> ... and so on until the end of the class
>
> I hope this saves someone some trouble when running and debugging
> their tests :)
Please click "Edit this file" https://github.com/cakephp/docs/blob/master/en/development/testing.rst
Go on... you know you want to.
AD
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment