mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 02:26:17 +00:00
Applied patch by 'preloader', closes #4561
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6937 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
abe853a978
commit
71790792d0
2 changed files with 10 additions and 3 deletions
|
@ -1419,7 +1419,11 @@ class Model extends Overloadable {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->validationErrors = $validationErrors;
|
||||
if (isset($validationErrors[$this->alias])) {
|
||||
$this->validationErrors = $validationErrors[$this->alias];
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case ($options['validate'] === 'only'):
|
||||
|
|
|
@ -2222,7 +2222,8 @@ class ModelTest extends CakeTestCase {
|
|||
'Comment' => array('comment' => 'This field cannot be left blank'),
|
||||
'Attachment' => array('attachment' => 'This field cannot be left blank')
|
||||
);
|
||||
$this->assertEqual($model->validationErrors, $expected);
|
||||
$this->assertEqual($model->validationErrors, $expected['Comment']);
|
||||
$this->assertEqual($model->Attachment->validationErrors, $expected['Attachment']);
|
||||
|
||||
$this->assertFalse($model->saveAll(
|
||||
array(
|
||||
|
@ -2231,7 +2232,8 @@ class ModelTest extends CakeTestCase {
|
|||
),
|
||||
array('validate' => 'only')
|
||||
));
|
||||
$this->assertEqual($model->validationErrors, $expected);
|
||||
$this->assertEqual($model->validationErrors, $expected['Comment']);
|
||||
$this->assertEqual($model->Attachment->validationErrors, $expected['Attachment']);
|
||||
}
|
||||
|
||||
function testSaveAllAtomic() {
|
||||
|
@ -2498,7 +2500,8 @@ class ModelTest extends CakeTestCase {
|
|||
$result = $model->find('all');
|
||||
$this->assertEqual($result, array());
|
||||
$expected = array('Comment' => array(0 => array('comment' => 'This field cannot be left blank')));
|
||||
$this->assertEqual($model->validationErrors, $expected);
|
||||
|
||||
$this->assertEqual($model->Comment->validationErrors, $expected['Comment']);
|
||||
|
||||
$this->assertIdentical($model->Comment->find('count'), 0);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue