Monday, October 15, 2012

Using separate data sets for the same fixture

I have a shell that sends out emails updating a person on their account status. In order to compile the list of people who need to receive this email today, I have a method that executes the appropriatefind('all') query and returns the list of recipients. I want to unit test this method to make sure this list is being generated correctly.

However, now I have two unit tests depending on my Person fixture - my Person model's test, and this shell test. The extra clutter from the Person model test makes it awkward to prepare a data set focused on my shell test. The tests are complected - if I change the data set for one, I might break the other.

Can I easily define separate data sets for the same fixture depending on the context? Can I create separate fixtures for separate tests? How?

This question is also posted on Stack Overflow if you'd like to answer it there.

--
Brad Koch


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate