Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more tests added

  • Loading branch information...
commit 3ca4d231bf80d2bb1c0572196f633da68c1a0db7 1 parent e6b1253
@ceeram ceeram authored
Showing with 16 additions and 3 deletions.
  1. +16 −3 lib/Cake/Test/Case/Model/ModelWriteTest.php
View
19 lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -6399,10 +6399,10 @@ public function testSaveAllFieldListValidateBelongsTo() {
// test belongsTo
$fieldList = array(
- 'Post' => array('title', 'author_id'),
+ 'Post' => array('title'),
'Author' => array('user')
);
- $TestModel->saveAll(array(
+ $data = array(
'Post' => array(
'title' => 'Post without body',
'body' => 'This will not be saved',
@@ -6411,7 +6411,8 @@ public function testSaveAllFieldListValidateBelongsTo() {
'user' => 'bob',
'test' => 'This will not be saved',
- )), array('fieldList' => $fieldList));
+ ));
+ $TestModel->saveAll($data, array('fieldList' => $fieldList));
$result = $TestModel->find('all');
$expected = array(
@@ -6570,6 +6571,18 @@ public function testSaveAllFieldListHasOne() {
));
$this->assertTrue($result);
$this->assertEmpty($TestModel->validationErrors);
+
+ $TestModel->Attachment->whitelist = array('id');
+ $fieldList = array(
+ 'Comment' => array('id', 'article_id', 'user_id'),
+ 'Attachment' => array('id')
+ );
+ $result = $TestModel->saveAll($record, array(
+ 'fieldList' => $fieldList
+ ));
+ $this->assertTrue($result);
+ $result = $TestModel->find('first', array('order' => array('Comment.created' => 'DESC')));
+ $this->assertEquals($result['Comment']['id'], $result['Attachment']['comment_id']);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.