protected static function ResourceResponseTestTrait::addOmittedObject in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::addOmittedObject()
- 10 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::addOmittedObject()
Add the omitted object to the document or merges it if one already exists.
Parameters
array $document: The JSON:API response document.
array $omitted: The omitted object.
3 calls to ResourceResponseTestTrait::addOmittedObject()
- ResourceResponseTestTrait::toCollectionResourceResponse in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceResponseTestTrait.php - Merges individual responses into a collection response.
- ResourceTestBase::decorateExpectedResponseForIncludedFields in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Decorates the expected response with included data and cache metadata.
- ResourceTestBase::testRevisions in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests individual and collection revisions.
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceResponseTestTrait.php, line 569
Class
- ResourceResponseTestTrait
- Utility methods for handling resource responses.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected static function addOmittedObject(array &$document, array $omitted) {
if (isset($document['meta']['omitted'])) {
$document['meta']['omitted'] = static::mergeOmittedObjects($document['meta']['omitted'], $omitted);
}
else {
$document['meta']['omitted'] = $omitted;
}
}