예제 #1
0
 public function testGetFirstError()
 {
     $result = new \r8\Validator\ErrorList();
     $this->assertNull($result->getFirstError());
     $result->addError("Test Error");
     $this->assertEquals("Test Error", $result->getFirstError());
     $result->addError("Another Error");
     $this->assertEquals("Test Error", $result->getFirstError());
 }
예제 #2
0
파일: Form.php 프로젝트: Nycto/Round-Eights
 /**
  * Returns an aggregated list of all the errors in this form
  *
  * @return \r8\ErrorList
  */
 public function getErrors()
 {
     $errors = new \r8\Validator\ErrorList();
     foreach ($this->validateForm() as $message) {
         $errors->addError($message);
     }
     foreach ($this->fields as $field) {
         foreach ($field->validate() as $message) {
             $errors->addError($message);
         }
     }
     return $errors;
 }