| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 16 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | View Code Duplication | public function it_should_transform_array(): void |
|
| 18 | { |
||
| 19 | $resource = new ErrorResource([ |
||
| 20 | 'aa' => 1, |
||
| 21 | 'aa2' => 2, |
||
| 22 | 'aa3' => 3, |
||
| 23 | ]); |
||
| 24 | |||
| 25 | $request = app(Request::class); |
||
| 26 | $response = $resource->additional(['custom' => '1'])->toResponse($request); |
||
| 27 | |||
| 28 | $expected = '{"errors":{"general":{"aa":1,"aa2":2,"aa3":3}},"custom":"1"}'; |
||
| 29 | |||
| 30 | $this->assertInstanceOf(JsonResponse::class, $response); |
||
| 31 | $this->assertSame($expected, $response->content()); |
||
| 32 | } |
||
| 33 | } |
||
| 34 |