Total Complexity | 3 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
10 | class RequestTest extends TestCase |
||
11 | { |
||
12 | public function testFactory(): void |
||
13 | { |
||
14 | $request = (new RequestFactory())->createRequest('get', (new UriFactory)->createUri('http://localhost:8021')); |
||
15 | self::assertStringEndsWith('GET', $request->getMethod()); |
||
16 | self::assertArrayHasKey('host', $request->getHeaders()); |
||
17 | self::assertStringEndsWith('localhost', $request->getHeaderLine('host')); |
||
18 | } |
||
19 | |||
20 | public function testTarget(): void |
||
21 | { |
||
22 | $request = new Request((new UriFactory)->createUri('http://localhost:8021/test/index.php?foo=bar')); |
||
23 | self::assertStringEndsWith('/test/index.php?foo=bar', $request->getRequestTarget()); |
||
24 | self::assertStringEndsWith('/foo', $request->withRequestTarget('/foo')->getRequestTarget()); |
||
25 | } |
||
26 | |||
27 | public function testBase(): void |
||
28 | { |
||
29 | $request = new Request((new UriFactory)->createUri('http://localhost:8021/test/index.php?foo=bar')); |
||
30 | self::assertStringEndsWith('/test/index.php?foo=bar', $request->getRequestTarget()); |
||
31 | } |
||
33 |