2018-11-13 17:48:07 +01:00
|
|
|
<?php
|
|
|
|
|
2023-02-03 20:41:59 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2018-11-13 17:48:07 +01:00
|
|
|
namespace Engelsystem\Test\Unit\Http\Exceptions;
|
|
|
|
|
|
|
|
use Engelsystem\Http\Exceptions\HttpException;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class HttpExceptionTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Http\Exceptions\HttpException::__construct
|
|
|
|
* @covers \Engelsystem\Http\Exceptions\HttpException::getHeaders
|
2019-04-24 11:01:37 +02:00
|
|
|
* @covers \Engelsystem\Http\Exceptions\HttpException::getStatusCode
|
2018-11-13 17:48:07 +01:00
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function testConstruct(): void
|
2018-11-13 17:48:07 +01:00
|
|
|
{
|
|
|
|
$exception = new HttpException(123);
|
|
|
|
$this->assertEquals(123, $exception->getStatusCode());
|
|
|
|
$this->assertEquals('', $exception->getMessage());
|
|
|
|
$this->assertEquals([], $exception->getHeaders());
|
|
|
|
|
|
|
|
$exception = new HttpException(404, 'Nothing found', ['page' => '/test']);
|
|
|
|
$this->assertEquals('Nothing found', $exception->getMessage());
|
|
|
|
$this->assertEquals(['page' => '/test'], $exception->getHeaders());
|
|
|
|
}
|
|
|
|
}
|