/** * @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.'); }
/** * calls $this->validator and provides Input name * This method must only be used to validate the parameters of the Input object and NOT the posted values. * @param string $value the value to test * @param string|array $rules the rules to test against * @param string $message custom error message * @return bool */ protected function validate($value, $rules, $message = null) { return $this->validator->validate($this->name, $value, $rules, $message); }