Skip to content

Commit

Permalink
Removing redundant code, cleaning up some sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 29, 2012
1 parent c31f87b commit 18c2611
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Model/ModelValidator.php
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Validator/CakeRule.php
Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions lib/Cake/Test/Case/Model/ModelValidationTest.php
Expand Up @@ -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
Expand All @@ -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',
Expand All @@ -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'),
Expand All @@ -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)),
Expand All @@ -123,8 +117,6 @@ public function testValidationParams() {
)
);
$this->assertEquals($expected, $TestModel->validatorParams);
$Validator->invalidFields();
$this->assertEquals($expected, $TestModel->validatorParams);
}

/**
Expand Down

0 comments on commit 18c2611

Please sign in to comment.