Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function test_json_response(): void |
||
31 | { |
||
32 | $_SERVER['REQUEST_URI'] = 'https://example.org/uri'; |
||
33 | $_SERVER['REQUEST_METHOD'] = Request::METHOD_GET; |
||
34 | |||
35 | Router::configure(static function (Routes $routes): void { |
||
36 | $routes->get('uri', static fn () => new JsonResponse([ |
||
1 ignored issue
–
show
|
|||
37 | 'key' => 'value', |
||
38 | ])); |
||
39 | }); |
||
40 | |||
41 | $this->expectOutputString('{"key":"value"}'); |
||
42 | |||
43 | self::assertSame([ |
||
44 | [ |
||
45 | 'header' => 'Content-Type: application/json', |
||
46 | 'replace' => true, |
||
47 | 'response_code' => 0, |
||
48 | ], |
||
49 | ], $this->headers()); |
||
50 | } |
||
52 |