Skip to content

Commit

Permalink
Adding tests for saving models with id == null. Closes #675
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 7, 2010
1 parent 1c34157 commit f152181
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cake/tests/cases/libs/model/model_write.test.php
Expand Up @@ -899,6 +899,19 @@ function testSaveWithCreate() {
$this->assertEqual($result, $expected);
}

/**
* test that a null Id doesn't cause errors
*
* @return void
*/
function testSaveWithNullId() {
$User =& new User();
$User->read(null, 1);
$User->data['User']['id'] = null;
$this->assertTrue($User->save(array('password' => 'test')));
$this->assertTrue($User->id > 0);
}

/**
* testSaveWithSet method
*
Expand Down

0 comments on commit f152181

Please sign in to comment.