|
@@ 61-70 (lines=10) @@
|
| 58 |
|
* |
| 59 |
|
* @throws PHPUnit_Framework_AssertionFailedError |
| 60 |
|
*/ |
| 61 |
|
public function assertJsonApiIdentifierCollection(array $array, $count = null) |
| 62 |
|
{ |
| 63 |
|
$this->assertArrayHasKey('data', $array, 'No data key for collection'); |
| 64 |
|
|
| 65 |
|
foreach ($array['data'] as $identifier) { |
| 66 |
|
$this->assertArrayHasAll(['type', 'id'], (array) $identifier); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
$this->assertCount($count, $array['data'], 'Incorrect object count returned in collection'); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
/** |
| 73 |
|
* Assert that an array contains a valid JSON API resource object collection. |
|
@@ 80-89 (lines=10) @@
|
| 77 |
|
* |
| 78 |
|
* @throws PHPUnit_Framework_AssertionFailedError |
| 79 |
|
*/ |
| 80 |
|
public function assertJsonApiObjectCollection(array $array, $count = null) |
| 81 |
|
{ |
| 82 |
|
$this->assertArrayHasKey('data', $array, 'No data key for collection'); |
| 83 |
|
|
| 84 |
|
foreach ($array['data'] as $object) { |
| 85 |
|
$this->assertArrayHasAll(['type', 'id', 'attributes'], (array) $object); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
$this->assertCount($count, $array['data'], 'Incorrect object count returned in collection'); |
| 89 |
|
} |
| 90 |
|
} |
| 91 |
|
|