Ejemplo n.º 1
0
<?php

use Siphon\Exception\HttpException;
describe("HttpException", function () {
    it("returns the exception status code and headers", function () {
        $e = new HttpException(404, 'Something not found', null, []);
        expect($e->getStatusCode())->toBe(404);
        expect($e->getHeaders())->toBe([]);
    });
});
 /**
  * Constructor
  *
  * @param array       $allow
  * @param null|string $message
  * @param \Exception  $previous
  * @param int         $code
  */
 public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0)
 {
     $headers = ['Allow' => strtoupper(implode(', ', $allow))];
     parent::__construct(405, $message, $previous, $headers, $code);
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  * @param null|string $message
  * @param \Exception  $previous
  * @param int         $code
  */
 public function __construct($message = null, \Exception $previous = null, $code = 0)
 {
     parent::__construct(404, $message, $previous, [], $code);
 }