On Oct 7, 6:10 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I am sure the docs do not contain the recent changes yet.
>
> My Model-tests work with fixtures. Here is a mini-example. Maybe you
> can see some detail that you have done differently.
>
> in phone.test.php
>
> App::import('Model', 'Phone');
>
> class PhoneTest extends Phone {
> var $name = 'PhoneTest';
> var $useDbConfig = 'test_suite';
>
> }
>
> class PhoneTestCase extends CakeTestCase {
> var $fixtures = array( 'app.phone_test' );
>
> function testStorage() {
> $this->PhoneTest =& new PhoneTest();
>
> $all = $this->PhoneTest->findAll();
>
> $this->assertEqual(4, count($all));
> }
>
> }
Actually, you can now instantiate your test models using
ClassRegistry::init('NameOfModel'); no need to riddle your tests with
fake Model classes, whose only purpose is to link model associations
and use a different database configuration. Your complete code snippet
above can be reduced to:
class PhoneTestCase extends CakeTestCase {
var $fixtures = array( 'app.phone_test' );
function testStorage() {
$this->PhoneTest =& ClassRegistry::init('PhoneTest');
$all = $this->PhoneTest->findAll();
$this->assertEqual(4, count($all));
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---