/**
  * test the __call method
  *
  * @return void
  */
 public function testBaseMagicCallMethod()
 {
     $title = "New Title";
     $detail = "Custom detail message";
     $status = 406;
     $code = "Some Status Code";
     $id = "13242134-456657-asdfasdf";
     $href = 'https://www.asdfasdfasdf.com/';
     $links = array('link' => 'link');
     $paths = array('something' => 'something');
     $testBaseSerializerException = new BaseSerializerException($title, $detail, $status, $code, $id, $href, $links, $paths);
     $this->assertEquals($title, $testBaseSerializerException->title(), "BaseSerializerException::title() should match our passed in `title`: {$title}");
     $this->assertEquals($detail, $testBaseSerializerException->detail(), "BaseSerializerException::detail() should match our passed in `detail`: {$detail}");
     $this->setExpectedException('BadMethodCallException', "No method or property ::getSomething for this class");
     $testBaseSerializerException->getSomething();
 }
 /**
  * Constructs a new instance of the base BaseJsonApiException
  *
  * @param string $title The title of the exception, passed to parent CakeException::__construct
  * @param array $validationErrors A CakePHP Model array of validation errors
  * @param int $status The http status code of the error, passed to parent CakeException::__construct
  * @param string $id A unique identifier for this particular occurrence of the problem.
  * @param string $href A URI that MAY yield further details about this particular occurrence of the problem.
  * @param array $links An array of JSON Pointers [RFC6901] to the associated resource(s) within the request document [e.g. ["/data"] for a primary data object].
  * @param array $paths An array of JSON Pointers to the relevant attribute(s) within the associated resource(s) in the request document. Each path MUST be relative to the resource path(s) expressed in the error object's "links" member [e.g. ["/first-name", "/last-name"] to reference a couple attributes].
  */
 public function __construct($title = 'Validation Failed', array $validationErrors = array(), $status = 422, $id = null, $href = null, $links = array(), $paths = array())
 {
     $this->validationErrors = $validationErrors;
     parent::__construct($title, $validationErrors, $status, $id, $href, $links, $paths);
 }
 /**
  * render the BaseSerializerException for a JSON API request
  *
  * @param BaseSerializerException $error an instance of BaseSerializerException
  * @return void
  */
 protected function renderSerializerAsJsonApi(BaseSerializerException $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');
     // Set the correct Status Code
     $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->detail()), 'links' => $error->links(), 'paths' => $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();
 }
 /**
  * Constructs a new instance of the base StatelessAuthException
  *
  * @param string $title The title of the exception, passed to parent CakeException::__construct
  * @param string $detail A human-readable explanation specific to this occurrence of the problem.
  * @param int $status The http status code of the error, passed to parent CakeException::__construct
  * @param string $id A unique identifier for this particular occurrence of the problem.
  * @param string $href A URI that MAY yield further details about this particular occurrence of the problem.
  * @param array $links An array of JSON Pointers [RFC6901] to the associated resource(s) within the request document [e.g. ["/data"] for a primary data object].
  * @param array $paths An array of JSON Pointers to the relevant attribute(s) within the associated resource(s) in the request document. Each path MUST be relative to the resource path(s) expressed in the error object's "links" member [e.g. ["/first-name", "/last-name"] to reference a couple attributes].
  */
 public function __construct($title = 'Stateless Auth Exception', $detail = 'Stateless Auth Exception', $status = 400, $id = null, $href = null, $links = null, $paths = null)
 {
     parent::__construct($title, $detail, $status, $id, $href, $links, $paths);
 }