Re: Fixtures problem in Cake 1.2

2008-01-21 Thread sidr

A have no problem with a test of single model
I said I cannot get records from the fixture for joined table
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Fixtures problem in Cake 1.2

2008-01-11 Thread sidr

I have the models Task and User
 array (

'className' => 'User',

'conditions'=> '',

'order' => '',

'foreignKey'=> 'user_id'
));
...
}
?>



Also I`m using fixtures

// user_test_fixture.php
 '1',
'username' => 'admin',
'password' => '4fea28c4a708335fbd36db8166edc95c', //admpass
'fullname' => 'Admin',
'blocked' => '0',
'created' => '2007-10-1 10:39:23',
'updated' => '2007-10-1 10:41:31'
)
);
}
?>

// task_test_fixture.php
 '1',
'name'  => 'Project-1',
'info'  => 'Prj-1 description',
'user_id'   => '1',
'parent_id' => '0',
'created'   => '2007-10-26 19:05:52',
'modified'  => '2007-10-26 19:05:00',
'starttime' => '-00-00 00:00:00',
'deadline'  => '2007-11-15 02:57:49',
'hours' => '40',
'done'  => '0',
'hidden'=> '0'
)
);
}


And the following I have in my task.test.php

model =& new TaskTest();
}


function testAuthor(){
$this->model->id = 2;
$task = $this->model->read();

$this->assertEqual( $task['Author']['username'], 'admin' );
}
}


But the test fails because $task['Author'] contains data from working
database, not from the fixture.

How could I fix it?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---