Wednesday, August 29, 2012

Related models in TestCases

Hello,

i am having following problem: $this->Model->find() doesn't get past the own model in a Test Case. For example, 
i have Comment belongsTo Article with public $belongsTo = array( 'Article' => array('className' => 'ArticlesPlugin.Article', 'foreignKey' => 'article_id')) in the Comment model
and public $hasMany = array('Comment' => array('classname' => 'ArticlesPlugin.Comment','foreignKey' => 'artilce_id')). The foreign keys are present and properly set. 
I have set the recursion in the Test case to '2' (don't know if thats needed?). 
The association is working in the $default database connection, even if using the sql-dump of the test database (using fixtures for the tests) as data. 
So to sum it up- the association is working in the application, but not in the test case. Is there something more that needs to be done in order for the Test case
to access related models?

Thanks, Boyan 

--
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-US.
 
 

No comments: