I have a model Beneficiary and a model Contract.
class Beneficiary extends Model {
var $name = 'Beneficiary';
var $hasMany = array(
'Contract'
);
}
class Contract extends Model {
var $name = 'Contract';
var $displayField = 'number';
var $belongsTo = array(
'Beneficiary'
);
}
I want to test the Beneficiary with the following unit test:
class BeneficiaryTestCase extends CakeTestCase {
var $fixtures = array('app.beneficiary');
function startTest() {
$this->Beneficiary =& ClassRegistry::init('Beneficiary');
}
function endTest() {
unset($this->Beneficiary);
ClassRegistry::flush();
}
function testSanity() {
$this->assertTrue(1 == 1);
}
}
But when I run it, I'm getting the error message "Error: Database
table users for model User was not found.", and I have no idea why.
When I remove the hasMany:Contract relationship, then it doesn't
complain. But Contract doesn't have anything to do with User!
I tracked the problem further to ClassRegistry::init(). When I echo
what is passed to init() as $class, then after some echos it echos
User! But I couldn't track it down deeper, it's too complicated for
me...
Anyone has an idea where this "User" could slip into my code??
I could also just add the User fixture to the test case, but that
wouldn't be clean...
Thanks really a lot for help, I just don't seem able to do it on my
own.
Josh
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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
No comments:
Post a Comment