mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
updating exists, fixes #3368, test added. thank you maular
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5733 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
8963c16c77
commit
356fd587cd
2 changed files with 18 additions and 2 deletions
|
@ -1142,11 +1142,10 @@ class Model extends Overloadable {
|
|||
}
|
||||
$this->afterSave($created);
|
||||
$this->data = false;
|
||||
$this->__exists = null;
|
||||
$this->_clearCache();
|
||||
$this->validationErrors = array();
|
||||
return true;
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -999,6 +999,23 @@ class ModelTest extends CakeTestCase {
|
|||
$this->assertEqual($result, 4);
|
||||
}
|
||||
|
||||
|
||||
function testUpdateExisting() {
|
||||
$this->model =& new User();
|
||||
|
||||
$model_id = 1000;
|
||||
|
||||
$this->model->id = $model_id;
|
||||
$this->model->delete();
|
||||
|
||||
$this->model->save( array('User'=>array('id'=>$model_id, 'user'=>'some user')) );
|
||||
$this->assertEqual($this->model->id, $model_id);
|
||||
|
||||
$this->model->save( array('User'=>array('user'=>'updated user')) );
|
||||
$this->assertEqual($this->model->id, $model_id);
|
||||
}
|
||||
|
||||
|
||||
function testBindUnbind() {
|
||||
$this->model =& new User();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue