On Dec 11, 3:22 pm, mark_story <[EMAIL PROTECTED]> wrote:
> How are your fixtures setup?
> Are you using imports?
> Are you initializing your models in setup() or startTest()?
> Are you using ClassRegistry::init() or are you use new Model()?

Hey Mark,

(i) Fixtures Setup (comments and wihitespaces stripped out)

user_group_fixture.php:

class UserGroupFixture extends CakeTestFixture
{
  public $name = 'UserGroup';
  public $import = array('model' => 'UserGroup', 'records' => true);
}

user_fixture.php:

class UserFixture extends CakeTestFixture
{
  public $name = 'User';
  public $import = array('model' => 'User', 'records' => false);
  public $records = array(
    array(
      'id'                        => 1,
      'user_group_id'             => 2,
      'name'                      => 'foo',
      'password'                  =>
'288f5ed10f9b731149ad3e3bcdd6add568bb61a3',
      'salt'                      => '34da1b0c',
      (...)
    )
  );
}

(ii) Using imports

Yes, schema is imported in all cases, records just in some cases.

(iii) Initializing of models

The model is initialized with ClassRegistry::init():

user.test.php

class UserTestCase extends CakeTestCase
{
  public $User = null;
  public $fixtures = array('app.user', 'app.user_group');
  public function start()
  {
    parent::start();
    Configure::write('debug', 2);
  }

  public function end()
  {
      parent::end();
  }

  public function startTest($method)
  {
    $this->User = ClassRegistry::init('User');
    $this->User->query("-- >>>>>>>>>>>>>>>>>>>>>> STARTING TEST: " .
$method . " <<<<<<<<<<<<<<<<<<<<<<<<");
  }

  public function endTest($method)
  {
  }

  public function testHashPassword()
  {
    $this->assertEqual($this->User->hashPassword('foo'), 'bar');
  }
}

In this example, the user model is associated with the user_group
model (user belongsTo user_group, user_group hasMany user). Tests are
failing with "Error:  Database table user_groups for model UserGroup
was not found." in this case.

This setup was fine until revision 7869. As of revision 7870 tests are
failing.

Marcus
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to