function ResourceResponseTestTrait::addOmittedObject
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::addOmittedObject()
- 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::addOmittedObject()
- 11.x 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 570
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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.