Example #1
0
 /**
  * Test the failure method to ensure it sends back the right data
  * @return void
  */
 public function testFailure()
 {
     $generalErrorMessage = 'Please check the values in your form.';
     $this->error->addField('name', 'Name is required.');
     $response = $this->error->failure($generalErrorMessage, array('id' => 123));
     $this->assertFalse($response['success']);
     $this->assertEquals($generalErrorMessage, $response['message']);
     $this->assertEquals(1, $response['total']);
     $this->assertEquals('name', $response['errors'][0]['id']);
     $this->assertEquals('Name is required.', $response['errors'][0]['msg']);
     $this->assertEquals(123, $response['object']['id']);
 }
 /**
  * Check if there is any error.
  * 
  * @access public
  * @return boolean Indicates if there is error.
  */
 public function hasError()
 {
     return $this->error !== null && $this->error instanceof modError && $this->error->hasError();
 }