Skip to content

Commit

Permalink
Changing test case to make it pass on Sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 23, 2011
1 parent 053ebf2 commit e4cc18c
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions lib/Cake/Test/Case/Model/ModelWriteTest.php
Expand Up @@ -5641,34 +5641,31 @@ public function testSaveAllFieldListHasOne() {
$this->loadFixtures('Attachment', 'Comment', 'Article', 'User');
$TestModel = new Comment();

$expected = $TestModel->find('first', array(
'conditions' => array('Comment.id' => 5),
'recursive' => 0
));
$TestModel->validate = array('comment' => 'notEmpty');
$TestModel->Attachment->validate = array('attachment' => 'notEmpty');

$fieldList = array(
'Comment' => array('id', 'article_id', 'user_id'),
'Attachment' => array('comment_id')
);
$result = $TestModel->saveAll(array(
$record = array(
'Comment' => array(
'id' => 5,
'comment' => $expected['Comment']['comment'] .' some more',
'user_id' => 1,
'article_id' => 1,
'comment' => '',
),
'Attachment' => array(
'comment_id' => $expected['Attachment']['comment_id'],
'attachment' => $expected['Attachment']['attachment'] .' some more'
'attachment' => ''
)
), array('fieldList' => $fieldList));
$this->assertTrue($result);
);
$result = $TestModel->saveAll($record, array('validate' => 'only'));
$this->assertFalse($result);

$result = $TestModel->find('first', array(
'conditions' => array('Comment.id' => 5),
'recursive' => 0
$fieldList = array(
'Comment' => array('id', 'article_id', 'user_id'),
'Attachment' => array('comment_id')
);
$result = $TestModel->saveAll($record, array(
'fieldList' => $fieldList, 'validate' => 'only'
));

$this->assertEquals($expected['Comment']['comment'], $result['Comment']['comment']);
$this->assertEquals($expected['Attachment']['attachment'], $result['Attachment']['attachment']);
$this->assertTrue($result);
$this->assertEmpty($TestModel->validationErrors);
}

}

0 comments on commit e4cc18c

Please sign in to comment.