Hmmm.... Anyone out there using baked tests in their testing infrastructure? Or am I just overestimating the number of tests that get written in "in the wild"? Or underestimating the need to write terser posts? :-)
If anyone is effectively using the 1.2 testing structure, or the predecessor standalone Test Suite <http://cakeforge.org/docman/? group_id=62>, I'd love to hear war stories. Thanks, Philip On Sep 28, 12:04 pm, Philip <[EMAIL PROTECTED]> wrote: > I'm just getting started with the testing infrastructure in CakePHP > 1.2. It was a little rough getting started, because few people > seemed to be able to point me to any sort of canonical documentation, > but thanks > tohttp://cakebaker.42dh.com/2007/03/23/how-to-use-the-official-cakephp-... > andhttp://bakery.cakephp.org/articles/view/testing-models-with-cakephp-1... > I'm getting up to speed now. Also this recent > thread:http://groups.google.com/group/cake-php/browse_thread/thread/b4e784c3... > will be helpful when I start testing controllers. > > (To the powers that be: Is there any way these articles could be > featured more prominently, say as part of some sort of testing portal > page on cakephp.org? I've had problems with the search there so I'm > not sure I would have found the bakery article if it weren't linked on > CakeBaker. I really lament that there's no longer an official wiki.) > > When I baked a few models I also requested tests even though I didn't > know what I was doing. I got, for example, a GameTestCase class that > I'm trying to build out now. > > Two questions: > > == Should it pass? == > My baked test file included the following commented method: > > function testMe() { > $result = $this->TestObject->findAll(); > $expected = 1; > $this->assertEqual($result, $expected); > } > > Of course this fails because findAll() returns a nested array, not an > integer. Is this supposed to pass? Did something change in the > return type of findAll()? Or was it merely intended that the user > would replace the expected 1 with something more substantial? > > == Necessary to subclass the model under test? == > > The Bakery article above makes a point of deriving a model from the > model under test: > > class ArticleTest extends Article { > var $name = 'ArticleTest'; > var $useDbConfig = 'test_suite'; > > } > > It also names the fixture ArticleTest. Is this an essential step to > use fixtures? Because bake did some of the other "plumbing" > mentioned in that article (e.g. loadModel), it made me wonder whether > I need to add another class or not. I was able to add the fixture so > it didn't appear to break my test, but perhaps I'm setting myself up > wrong for the future. > > Forgive my curiosity if these questions are just nitpicking -- I try > to err on the side of asking too many questions, because they say > there may be other curious people who just haven't gotten around to > asking. ;-) > > Regards, > > Philiphttp://www.bulldogs.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
