Add test for saveField() + foreign key.

Closes #2507
This commit is contained in:
mark_story 2012-01-24 20:32:48 -05:00
parent b8e27c7588
commit dbece1f157

View file

@ -611,12 +611,26 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals($expected, $result);
$TestModel->recursive = -1;
$result = $TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
$TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
$TestModel->id = 1;
$result = $TestModel->saveField('title', '', true);
$this->assertFalse($result);
$TestModel->recursive = -1;
$TestModel->id = 1;
$result = $TestModel->saveField('user_id', 9999);
$this->assertTrue((bool)$result);
$result = $TestModel->read(array('id', 'user_id'), 1);
$expected = array('Article' => array(
'id' => '1',
'user_id' => '9999',
));
$this->assertEquals($expected, $result);
$this->loadFixtures('Node', 'Dependency');
$Node = new Node();
$Node->set('id', 1);