/**
  * test that saveMany behaves like plain save() when suplied empty data
  *
  * @link https://cakephp.lighthouseapp.com/projects/42648/tickets/277-test-saveall-with-validation-returns-incorrect-boolean-when-saving-empty-data
  * @return void
  */
 public function testSaveManyEmptyData()
 {
     $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.');
     $this->loadFixtures('Article', 'ProductUpdateAll', 'Comment', 'Attachment');
     $model = new Article();
     $result = $model->saveMany(array(), array('validate' => true));
     $this->assertFalse(empty($result));
     $model = new ProductUpdateAll();
     $result = $model->saveMany(array());
     $this->assertFalse($result);
 }
Example #2
0
 /**
  * testSaveManyDeepHasManyValidationFailure method
  *
  * @return void
  */
 public function testSaveManyDeepHasManyValidationFailure()
 {
     $this->loadFixtures('Article', 'Comment');
     $TestModel = new Article();
     $TestModel->Comment->validate = array('comment' => array('notBlank' => array('rule' => array('notBlank'))));
     $result = $TestModel->saveMany(array(array('user_id' => 1, 'title' => 'New Article', 'body' => 'This article contains a invalid comment', 'Comment' => array(array('user_id' => 1, 'comment' => '')))), array('deep' => true));
     $this->assertFalse($result);
     $this->assertEquals(array(array('Comment' => array(array('comment' => array('notBlank'))))), $TestModel->validationErrors);
 }