/** * @expectedException \WinkForm\Validation\ValidationException */ public function testValidationException() { $this->validator->validate('test', 'non numeric value', 'numeric|max:8|in:2,3,4'); if (!$this->validator->isValid()) { throw new ValidationException('The test throws the exception', $this->validator->getErrors()); } $this->fail('The ValidationException should have been thrown.'); }
/** * This should always be called at the start of render() * check result of validity checks of parameters passed to this Input element * @throws \Exception */ protected function checkValidity() { if (!$this->validator->isValid()) { throw new \Exception($this->renderValidationErrors('Error rendering ' . get_class($this) . ' object with name ' . $this->name)); } }