| Total Complexity | 2 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | trait AssertResourceLinkage |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Asserts that a resource object correspond to a given model. |
||
| 12 | * |
||
| 13 | * @param Model $expected |
||
| 14 | * @param string $resourceType |
||
| 15 | * @param array $json |
||
| 16 | */ |
||
| 17 | public static function assertResourceIdentifierEqualsModel($expected, $resourceType, $json) |
||
| 18 | { |
||
| 19 | $expected = HelperFactory::create('resource-identifier', $expected, $resourceType)->toArray(); |
||
| 20 | |||
| 21 | static::assertResourceIdentifierEquals($expected, $json); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Asserts that an array of resource objects correspond to a given collection. |
||
| 26 | * |
||
| 27 | * @param Collection $collection |
||
| 28 | * @param string $resourceType |
||
| 29 | * @param array $json |
||
| 30 | */ |
||
| 31 | public static function assertResourceCollectionEqualsCollection($collection, $resourceType, $json) |
||
| 32 | { |
||
| 33 | $expected = HelperFactory::create('collection', $collection, $resourceType, false)->toArray(); |
||
| 34 | |||
| 35 | static::assertResourceCollectionEquals($expected, $json); |
||
| 36 | } |
||
| 38 |