diff --git a/lib/Cake/Test/Case/Model/Validator/CakeValidationRuleTest.php b/lib/Cake/Test/Case/Model/Validator/CakeValidationRuleTest.php index 31caf5f34fa..e0d9c8b35f0 100644 --- a/lib/Cake/Test/Case/Model/Validator/CakeValidationRuleTest.php +++ b/lib/Cake/Test/Case/Model/Validator/CakeValidationRuleTest.php @@ -73,6 +73,7 @@ public function testIsValid() { $Rule->process('fieldName', $data, $methods); $this->assertTrue($Rule->isValid()); } + /** * tests that passing custom validation methods work * @@ -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 *