/**
  * test the __call method
  *
  * @return void
  */
 public function testValidationMagicCallMethod()
 {
     $title = "New Title";
     $validationErrors = array('username' => array("Username can not be empty", "Username can only be alphanumeric"), 'first_name' => array("First Name can only be alphanumeric and not empty"));
     $status = 422;
     $testValidationBaseSerializerException = new ValidationBaseSerializerException($title, $validationErrors, $status);
     $this->assertEquals($title, $testValidationBaseSerializerException->title(), "ValidationBaseSerializerException::title() should match our passed in `title`: {$title}");
     $this->assertEquals($status, $testValidationBaseSerializerException->status(), "ValidationBaseSerializerException::status() should match our passed in `status`: {$status}");
     $this->assertEquals($validationErrors, $testValidationBaseSerializerException->validationErrors(), "ValidationBaseSerializerException::validationErrors() should match our passed in `detail`");
     $this->setExpectedException('BadMethodCallException', "No method or property ::getSomething for this class");
     $testValidationBaseSerializerException->getSomething();
 }
 /**
  * render the ValidationBaseSerializerException for a JSON API request
  *
  * @param ValidationBaseSerializerException $error an instance of ValidationBaseSerializerException
  * @return void
  */
 protected function renderValidationSerializerAsJsonApi(ValidationBaseSerializerException $error)
 {
     // Add a response type for JSON API
     $this->controller->response->type(array('jsonapi' => 'application/vnd.api+json'));
     // Set the controller to response as JSON API
     $this->controller->response->type('jsonapi');
     $this->addHttpCodes();
     $this->controller->response->statusCode($error->status());
     // set the errors object to match JsonApi's standard
     $errors = array('errors' => array(array('id' => h($error->id()), 'href' => h($error->href()), 'status' => h($error->status()), 'code' => h($error->code()), 'title' => h($error->title()), 'detail' => h($error->validationErrors()), 'links' => h($error->links()), 'paths' => h($error->paths()))));
     // json encode the errors
     $jsonEncodedErrors = json_encode($errors);
     // set the body to the json encoded errors
     $this->controller->response->body($jsonEncodedErrors);
     return $this->controller->response->send();
 }