diff options
Diffstat (limited to 'tests/Unit/Http/Exceptions/HttpExceptionTest.php')
-rw-r--r-- | tests/Unit/Http/Exceptions/HttpExceptionTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Unit/Http/Exceptions/HttpExceptionTest.php b/tests/Unit/Http/Exceptions/HttpExceptionTest.php new file mode 100644 index 00000000..ce2b064d --- /dev/null +++ b/tests/Unit/Http/Exceptions/HttpExceptionTest.php @@ -0,0 +1,26 @@ +<?php + +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::getStatusCode + * @covers \Engelsystem\Http\Exceptions\HttpException::getHeaders + */ + public function testConstruct() + { + $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()); + } +} |