Permalink
Browse files

Add BC test for #4851

  • Loading branch information...
rchavik committed Oct 13, 2014
1 parent ecf0307 commit dc7b8cbb89c92dc46777abcad90fdfb50e704515
Showing with 27 additions and 0 deletions.
  1. +27 −0 lib/Cake/Test/Case/Model/ModelValidationTest.php
@@ -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');
}
}
/**

0 comments on commit dc7b8cb

Please sign in to comment.