Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changing test case to make it pass on Sqlite

  • Loading branch information...
commit e4cc18c0e7201b987d8d0fb5eadda7e286daa2f6 1 parent 053ebf2
@ADmad ADmad authored
Showing with 18 additions and 21 deletions.
  1. +18 −21 lib/Cake/Test/Case/Model/ModelWriteTest.php
View
39 lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -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);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.