From 63caf566fb82df7b4f9ddd2019773e92827637ec Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 13 Feb 2011 12:22:29 -0500 Subject: [PATCH] Adding some tests around invalidFields() and fieldList options. Closes #1534 --- cake/tests/cases/libs/model/model_validation.test.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cake/tests/cases/libs/model/model_validation.test.php b/cake/tests/cases/libs/model/model_validation.test.php index bbf00996e..d0b3fb648 100644 --- a/cake/tests/cases/libs/model/model_validation.test.php +++ b/cake/tests/cases/libs/model/model_validation.test.php @@ -131,13 +131,14 @@ class ModelValidationTest extends BaseModelTest { $TestModel =& new ValidationTest1(); $TestModel->validate = $validate = array( 'title' => array( - 'rule' => 'customValidator', + 'rule' => 'alphaNumeric', 'required' => true ), 'name' => array( - 'rule' => 'allowEmpty', + 'rule' => 'alphaNumeric', 'required' => true )); + $TestModel->set(array('title' => '$$', 'name' => '##')); $TestModel->invalidFields(array('fieldList' => array('title'))); $expected = array( 'title' => 'This field cannot be left blank' @@ -175,9 +176,9 @@ class ModelValidationTest extends BaseModelTest { */ function testInvalidFieldsWhitelist() { $TestModel =& new ValidationTest1(); - $TestModel->validate = $validate = array( + $TestModel->validate = array( 'title' => array( - 'rule' => 'customValidator', + 'rule' => 'alphaNumeric', 'required' => true ), 'name' => array( @@ -186,7 +187,7 @@ class ModelValidationTest extends BaseModelTest { )); $TestModel->whitelist = array('name'); - $TestModel->save(array('name' => '#$$#')); + $TestModel->save(array('name' => '#$$#', 'title' => '$$$$')); $expected = array('name' => 'This field cannot be left blank'); $this->assertEqual($TestModel->validationErrors, $expected);