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()); }
/** * 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; }