runField() public method

The array is expected to have keys named after fields. This function will call reset() before it runs.
Since: 2.0
public runField ( string $field, array $data, Fuel\Validation\ResultInterface $result = null ) : Fuel\Validation\ResultInterface
$field string
$data array
$result Fuel\Validation\ResultInterface
return Fuel\Validation\ResultInterface
Beispiel #1
0
 /**
  * Validates one key-value pair
  *
  * @param string $key
  * @param mixed  $value
  */
 public function validateOne($key, $value)
 {
     $result = $this->validator->runField($key, array($key => $value));
     if ($result->isValid() === false) {
         throw new InvalidArgumentException($result->getError($key));
     }
 }
Beispiel #2
0
 public function testRunFieldFailure()
 {
     $this->assertFalse($this->object->runField('email', array())->isValid());
 }