/** * Test for get errors */ public function testErrors() { $data = array('field' => 'title', 'message' => 'Is a required field'); $result = array($data); $error = new Phprojekt_Error(); $error->addError(); $return = $error->getError(); $this->assertEquals(array(array()), $return); $error->addError($data); $return = $error->getError(); $this->assertEquals($result, $return); }
/** * Return an error array if there is any error. * * @return array Array with 'field', 'label' and 'message'. */ public function getError() { $errors = $this->_error->getError(); return array_pop($errors); }