Esempio n. 1
0
 /**
  * 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);
 }
Esempio n. 2
0
 /**
  * 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);
 }