Skip to content

Commit

Permalink
Add additional tests for error triggering on missing validator.
Browse files Browse the repository at this point in the history
Closes #3039
  • Loading branch information
markstory committed Jul 15, 2012
1 parent cc44130 commit 928de97
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/Cake/Test/Case/Model/Validator/CakeValidationRuleTest.php
Expand Up @@ -73,6 +73,7 @@ public function testIsValid() {
$Rule->process('fieldName', $data, $methods);
$this->assertTrue($Rule->isValid());
}

/**
* tests that passing custom validation methods work
*
Expand All @@ -98,6 +99,24 @@ public function testCustomMethods() {
$this->assertFalse($Rule->isValid());
}

/**
* Make sure errors are triggered when validation is missing.
*
* @expectedException PHPUnit_Framework_Error_Warning
* @expectedExceptionMessage Could not find validation handler totallyMissing for fieldName
* @return void
*/
public function testCustomMethodMissingError() {
$def = array('rule' => array('totallyMissing'));
$data = array(
'fieldName' => 'some data'
);
$methods = array('mytestrule' => array($this, 'myTestRule'));

$Rule = new CakeValidationRule($def);
$Rule->process('fieldName', $data, $methods);
}

/**
* Test isRequired method
*
Expand Down

0 comments on commit 928de97

Please sign in to comment.