| Conditions | 2 |
| Paths | 2 |
| Total Lines | 35 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 27 | public static function assertIsDeletedResponse( |
|
| 27 | TestResponse $response, |
||
| 28 | $expectedMeta, |
||
| 29 | bool $strict |
||
| 30 | ) { |
||
| 31 | 27 | $response->assertStatus(200); |
|
| 32 | 24 | $response->assertHeader( |
|
| 33 | 24 | HttpHeader::HEADER_NAME, |
|
| 34 | 24 | HttpHeader::MEDIA_TYPE |
|
| 35 | ); |
||
| 36 | |||
| 37 | // Decode JSON response |
||
| 38 | 21 | $json = $response->json(); |
|
| 39 | |||
| 40 | // Checks response structure |
||
| 41 | 21 | static::assertHasValidStructure( |
|
| 42 | 21 | $json, |
|
| 43 | $strict |
||
| 44 | ); |
||
| 45 | |||
| 46 | 12 | static::assertContainsOnlyAllowedMembers( |
|
| 47 | [ |
||
| 48 | 12 | Members::META, |
|
| 49 | Members::JSONAPI |
||
| 50 | ], |
||
| 51 | $json |
||
| 52 | ); |
||
| 53 | |||
| 54 | // Checks meta object |
||
| 55 | 9 | $meta = $json[Members::META]; |
|
| 56 | 9 | if ($expectedMeta !== null) { |
|
| 57 | 9 | PHPUnit::assertEquals( |
|
| 58 | 9 | $expectedMeta, |
|
| 59 | 9 | $meta, |
|
| 60 | 9 | Messages::META_OBJECT_IS_NOT_AS_EXPECTED |
|
| 61 | ); |
||
| 65 |