| Total Complexity | 3 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Coverage | 33.33% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | trait AssertInclude |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Asserts that an array of included resource objects contains a given resource object or collection. |
||
| 16 | * |
||
| 17 | * (@see assertResourceCollectionContains) |
||
| 18 | * |
||
| 19 | * @param array $expected A single resource object or an array of expected resource objects |
||
| 20 | * @param array $json The array of included resource objects to inspect |
||
| 21 | * |
||
| 22 | * @return void |
||
| 23 | * @throws \PHPUnit\Framework\ExpectationFailedException |
||
| 24 | */ |
||
| 25 | 6 | public static function assertIncludeObjectContains($expected, $json) |
|
| 26 | { |
||
| 27 | 6 | if (!\is_array($expected)) { |
|
|
|
|||
| 28 | static::invalidArgument( |
||
| 29 | 1, |
||
| 30 | 'array', |
||
| 31 | $expected |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 35 | 6 | static::assertResourceCollectionContains($expected, $json); |
|
| 36 | 3 | } |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Asserts that a JSON document contains an expected included collection. |
||
| 40 | * |
||
| 41 | * @param array $expected A single resource object or an array of expected resource objects |
||
| 42 | * @param array $json The JSON document to be tested |
||
| 43 | * |
||
| 44 | * @return void |
||
| 45 | * @throws \PHPUnit\Framework\ExpectationFailedException |
||
| 46 | */ |
||
| 47 | public static function assertDocumentContainsInclude($expected, $json) |
||
| 54 | } |
||
| 55 | } |
||
| 56 |