Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing redundant code, cleaning up some sentences

  • Loading branch information...
commit 18c26119f3f4dbc8e814c4c44fc66b607e33630f 1 parent c31f87b
@lorenzo lorenzo authored
View
2  lib/Cake/Model/ModelValidator.php
@@ -272,7 +272,7 @@ public function getMethods() {
}
$methods = array();
- foreach (get_class_methods($this->_model) as $method); {
+ foreach (get_class_methods($this->_model) as $method) {
$methods[strtolower($method)] = array($this->_model, $method);
}
View
2  lib/Cake/Model/Validator/CakeRule.php
@@ -267,7 +267,7 @@ public function dispatchValidation(&$data, &$methods) {
$this->_valid = call_user_func_array($methods[$rule], $this->_ruleParams);
} elseif (class_exists('Validation') && method_exists('Validation', $this->_rule)) {
$this->_valid = call_user_func_array(array('Validation', $this->_rule), $this->_ruleParams);
- } elseif (!is_array($validator['rule'])) {
+ } elseif (is_string($validator['rule'])) {
$this->_valid = preg_match($this->_rule, $data[$this->_field]);
} elseif (Configure::read('debug') > 0) {
trigger_error(__d('cake_dev', 'Could not find validation handler %s for %s', $this->_rule, $this->_field), E_USER_WARNING);
View
8 lib/Cake/Test/Case/Model/ModelValidationTest.php
@@ -32,7 +32,6 @@ class ModelValidationTest extends BaseModelTest {
*/
public function testValidationParams() {
$TestModel = new ValidationTest1();
- $Validator = new ModelValidator($TestModel);
$TestModel->validate['title'] = array(
'rule' => 'customValidatorWithParams',
'required' => true
@@ -56,8 +55,6 @@ public function testValidationParams() {
'ignoreOnSame' => 'id'
);
$this->assertEquals($expected, $TestModel->validatorParams);
- $Validator->invalidFields();
- $this->assertEquals($expected, $TestModel->validatorParams);
$TestModel->validate['title'] = array(
'rule' => 'customValidatorWithMessage',
@@ -68,7 +65,6 @@ public function testValidationParams() {
);
$this->assertEquals($expected, $TestModel->invalidFields());
- $this->assertEquals($expected, $Validator->invalidFields());
$TestModel->validate['title'] = array(
'rule' => array('customValidatorWithSixParams', 'one', 'two', null, 'four'),
@@ -95,8 +91,6 @@ public function testValidationParams() {
'six' => 6
);
$this->assertEquals($expected, $TestModel->validatorParams);
- $Validator->invalidFields();
- $this->assertEquals($expected, $TestModel->validatorParams);
$TestModel->validate['title'] = array(
'rule' => array('customValidatorWithSixParams', 'one', array('two'), null, 'four', array('five' => 5)),
@@ -123,8 +117,6 @@ public function testValidationParams() {
)
);
$this->assertEquals($expected, $TestModel->validatorParams);
- $Validator->invalidFields();
- $this->assertEquals($expected, $TestModel->validatorParams);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.