debuggable

 
Contact Us
 

PDF Version of The Unit Testing Talk Slides

Posted on 20/2/08 by Tim Koschützki

Oh yeah, some people requested these and it seems I sort of forgot about it already (gah). Sorry about that. : /

The thing is that every effect from the original Mac Keynote slides (see two posts earlier) is on one PDF page. That way I did not need to rearrange everything and then rebuild some slides that contain many effects. Also, you get a feeling of what the real slides were like if you are not on a mac. If you need some other version of the slides, be sure to comment on this post to let me know. Hope this fits most people's needs.

Alright enough of the chatter already, download them here:

CakePHP Unit Testing Talk PDF Slides

 
&nsbp;

You can skip to the end and add a comment.

Andy  said on Mar 05, 2008:

You never give an example of doing test cases with importing a a model into the fixture. I don't think importing an existing model into fixture works. Do you have any example?

Tim Koschuetzki said on Mar 24, 2008:

What do you mean by importing a model into a fixture? You mean importing the data of a model on the real database into the test database?

Andy  said on Mar 24, 2008:

What i mean is that in a Fixture, I need to create the table structure first before I can create my mock data using $records.

For example, in a Fixture, I can use $fields to specify the column details, or I can import a model from my real models so that I don't need to do populate the $fields.

(Example from http://bakery.cakephp.org/articles/view/testing-models-with-cakephp-1-2-test-suite )

class ArticleTestFixture extends CakeTestFixture {
var $name = 'ArticleTest';

var $import = 'Article';

}

I think in your fixture examples, they only show how to populate the $fields. I just want to know if you have tried to use $import. I have problem using the $import to create my TestFixture especially when my imported model has relationships defined.

Tim Koschuetzki said on Mar 24, 2008:

Ahh that yeah thanks, I should have added that to the slides.

What is your exact problem? Can you paste some code and tell me what is wrong?

Andy Sio  said on Mar 25, 2008:

I think that is more due to the Cake 1.2 beta. It doesn't handle very well when you want to import Model that has relationship defined. For example, if i want to import the model Article into the test fixture, the test.php script will load the Model Article instead of ArticleTest. If you have relationship defined, it just doesn't look up other models because you don't have the releated test models created in the fixture. Sorry that I don't have code now. I know it's pretty hard to explain without example.

Anyway, I know many people has experienced this problem in the Google Group because I have been researching this for some time. I don't find a perfect answer. So, I took your approach and incorporated other's people suggestions in Google group to create my own solution.

This is the solution that I came up with that works the best for me if I want to use fixture to test models. Let me know if you have a better solution.

http://zerostudios.blogspot.com/2008/03/cakephp-12-unit-testing.html

Tim Koschuetzki said on Mar 25, 2008:

hrm i pretty much like your approach. What I did thus far is create that ArticleTest model and change the db config setting there. But your approach with changing it in the App_Model based on some TEST_CASES constant is pretty good. :]

Yeah well do you happen to have some code in the future about your import problem>

This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.