Beispiel #1
0
 /**
  * execute the validations and return the result
  * This method will always run all validations (again)
  * @return bool
  */
 public function run()
 {
     $validator = new WinkValidator($this->translator, $this->getValidationData(), $this->getValidationRules());
     $this->isValid = $validator->passes();
     $this->fetchMessages($validator);
     return $this->isValid;
 }
 /**
  * test that all objects in array or collection are instance of given object
  */
 public function testCollectionOf()
 {
     $rule = 'collection_of:WinkForm\\Input\\TextInput,WinkForm\\Input\\Input';
     // array of TextInput objects that are also Input objects
     $inputs = array(new TextInput('test1'), new TextInput('test2'), new TextInput('test3'));
     $validator = new WinkValidator($this->translator, array($inputs), array($rule));
     $this->assertTrue($validator->passes(), 'all values in array are instance of TextInput and Input');
     // now test with Collection object
     $inputs = new Collection($inputs);
     $validator = new WinkValidator($this->translator, array($inputs), array($rule));
     $this->assertTrue($validator->passes(), 'all values in array are instance of TextInput and Input');
 }