blob: 04190f288e05f526c95a5d4c0bd4e30fca26f395 (
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;
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());
}
}
|