Skip to content

Commit

Permalink
Add test for saveField() + foreign key.
Browse files Browse the repository at this point in the history
Closes #2507
  • Loading branch information
markstory committed Jan 25, 2012
1 parent b8e27c7 commit dbece1f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/Cake/Test/Case/Model/ModelWriteTest.php
Expand Up @@ -611,12 +611,26 @@ public function testSaveField() {
$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);
Expand Down

0 comments on commit dbece1f

Please sign in to comment.