Changing test case to make it pass on Sqlite

This commit is contained in:
ADmad 2011-12-24 01:18:07 +05:30
parent 053ebf211e
commit e4cc18c0e7

View file

@ -5641,34 +5641,31 @@ class ModelWriteTest extends BaseModelTest {
$this->loadFixtures('Attachment', 'Comment', 'Article', 'User'); $this->loadFixtures('Attachment', 'Comment', 'Article', 'User');
$TestModel = new Comment(); $TestModel = new Comment();
$expected = $TestModel->find('first', array( $TestModel->validate = array('comment' => 'notEmpty');
'conditions' => array('Comment.id' => 5), $TestModel->Attachment->validate = array('attachment' => 'notEmpty');
'recursive' => 0
)); $record = array(
'Comment' => array(
'user_id' => 1,
'article_id' => 1,
'comment' => '',
),
'Attachment' => array(
'attachment' => ''
)
);
$result = $TestModel->saveAll($record, array('validate' => 'only'));
$this->assertFalse($result);
$fieldList = array( $fieldList = array(
'Comment' => array('id', 'article_id', 'user_id'), 'Comment' => array('id', 'article_id', 'user_id'),
'Attachment' => array('comment_id') 'Attachment' => array('comment_id')
); );
$result = $TestModel->saveAll(array( $result = $TestModel->saveAll($record, array(
'Comment' => array( 'fieldList' => $fieldList, 'validate' => 'only'
'id' => 5,
'comment' => $expected['Comment']['comment'] .' some more',
),
'Attachment' => array(
'comment_id' => $expected['Attachment']['comment_id'],
'attachment' => $expected['Attachment']['attachment'] .' some more'
)
), array('fieldList' => $fieldList));
$this->assertTrue($result);
$result = $TestModel->find('first', array(
'conditions' => array('Comment.id' => 5),
'recursive' => 0
)); ));
$this->assertTrue($result);
$this->assertEquals($expected['Comment']['comment'], $result['Comment']['comment']); $this->assertEmpty($TestModel->validationErrors);
$this->assertEquals($expected['Attachment']['attachment'], $result['Attachment']['attachment']);
} }
} }