Skip to content

Commit

Permalink
Add BC test for #4851
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed Oct 13, 2014
1 parent ecf0307 commit dc7b8cb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/Cake/Test/Case/Model/ModelValidationTest.php
Expand Up @@ -2449,6 +2449,33 @@ public function testIsUniqueValidator() {
$this->assertFalse($Article->validates(), 'Should fail, conditions are combined with or');
}

/**
* Test backward compatibility of the isUnique method when used as a validator for multiple fields.
*
* @return void
*/
public function testBackwardCompatIsUniqueValidator() {
$this->loadFixtures('Article');
$Article = ClassRegistry::init('Article');
$Article->validate = array(
'title' => array(
'duplicate' => array(
'rule' => 'isUnique',
'message' => 'Title must be unique',
),
'minLength' => array(
'rule' => array('minLength', 1),
'message' => 'Title cannot be empty',
),
)
);
$data = array(
'title' => 'First Article',
);
$data = $Article->create($data);
$this->assertFalse($Article->validates(), 'Contains a dupe');
}

}

/**
Expand Down

0 comments on commit dc7b8cb

Please sign in to comment.