mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Changing test case to make it pass on Sqlite
This commit is contained in:
parent
053ebf211e
commit
e4cc18c0e7
1 changed files with 19 additions and 22 deletions
|
@ -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']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue