Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class FormmaterTest extends TestCase |
||
11 | { |
||
12 | public function testOptions(): void |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @dataProvider dataProviderFormat |
||
24 | */ |
||
25 | public function testFormat(Response $response): void |
||
26 | { |
||
27 | $formater = new Formatter(); |
||
28 | $formater->format($response); |
||
29 | $this->assertSame('application/json; charset=UTF-8', $response->getHeaders()->get('Content-Type')); |
||
30 | if ($response->data instanceof PayloadInterface) { |
||
31 | $data = $response->data->toArray(); |
||
32 | } else { |
||
33 | $data = $response->data; |
||
34 | } |
||
35 | $this->assertSame(json_encode($data, $formater->getOptions()), $response->content); |
||
36 | } |
||
37 | |||
38 | public function dataProviderFormat(): array |
||
46 | ]; |
||
47 | } |
||
49 |