summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Exceptions/HttpExceptionTest.php
blob: ce2b064d6ff248f515a80ffb86ee5a77e9c94334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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());
    }
}