Exceptions: Added HttpNotFound exception
parent
8d090438b6
commit
1b3e3b1d65
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Engelsystem\Http\Exceptions;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class HttpNotFound extends HttpException
|
||||
{
|
||||
/**
|
||||
* @param string $message
|
||||
* @param array $headers
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
string $message = '',
|
||||
array $headers = [],
|
||||
int $code = 0,
|
||||
Throwable $previous = null
|
||||
) {
|
||||
parent::__construct(404, $message, $headers, $code, $previous);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Engelsystem\Test\Unit\Http\Exceptions;
|
||||
|
||||
use Engelsystem\Http\Exceptions\HttpNotFound;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class HttpNotFoundTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Engelsystem\Http\Exceptions\HttpNotFound::__construct
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$exception = new HttpNotFound();
|
||||
$this->assertEquals(404, $exception->getStatusCode());
|
||||
$this->assertEquals('', $exception->getMessage());
|
||||
|
||||
$exception = new HttpNotFound('Nothing to see here!');
|
||||
$this->assertEquals('Nothing to see here!', $exception->getMessage());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue