I was writing tests for controllers in a plugin and found that many
tests failed beacause the controller instantiated the model as a
generic AppModel class. I'm using this approach by Mark Story:
http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way
(By the way, the actions worked well in the old "manual browser
testing" so this issue could be related to the test suite and plugins.)
This test failed:
function testGroupModelInstance() {
$this->assertEqual(get_class($this->Groups->Group), 'Group');
}
I found that calling App:import('Model') at the beginning solves the
issue
App::import('Accounts.Group');
I din't find this well documented, so I comment here for discussion.
---
Fran Iglesias <cakephpilia@gmail.com>
http://cakephpilia.blogspot.com
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment