diff options
Diffstat (limited to 'tests/Unit/Http/Exceptions/HttpRedirectTest.php')
-rw-r--r-- | tests/Unit/Http/Exceptions/HttpRedirectTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Unit/Http/Exceptions/HttpRedirectTest.php b/tests/Unit/Http/Exceptions/HttpRedirectTest.php new file mode 100644 index 00000000..04190f28 --- /dev/null +++ b/tests/Unit/Http/Exceptions/HttpRedirectTest.php @@ -0,0 +1,26 @@ +<?php + +namespace Engelsystem\Test\Unit\Http; + +use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; +use Engelsystem\Http\Exceptions\HttpRedirect; +use PHPUnit\Framework\TestCase; + +class HttpRedirectTest extends TestCase +{ + use ArraySubsetAsserts; + + /** + * @covers \Engelsystem\Http\Exceptions\HttpRedirect::__construct + */ + public function testConstruct() + { + $exception = new HttpRedirect('https://lorem.ipsum/foo/bar'); + $this->assertEquals(302, $exception->getStatusCode()); + $this->assertArraySubset(['Location' => 'https://lorem.ipsum/foo/bar'], $exception->getHeaders()); + + $exception = new HttpRedirect('/test', 301, ['lorem' => 'ipsum']); + $this->assertEquals(301, $exception->getStatusCode()); + $this->assertArraySubset(['lorem' => 'ipsum'], $exception->getHeaders()); + } +} |