function ResourceTestBase::removeResourceTypeFromDocument
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::removeResourceTypeFromDocument()
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::removeResourceTypeFromDocument()
- 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::removeResourceTypeFromDocument()
Makes the JSON:API document violate the spec by omitting the resource type.
Parameters
array $document: A JSON:API document.
Return value
array The same JSON:API document, without its resource type.
1 call to ResourceTestBase::removeResourceTypeFromDocument()
- ResourceTestBase::testPostIndividual in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests POSTing an individual resource, plus edge cases to ensure good DX.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 860
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function removeResourceTypeFromDocument(array $document) {
unset($document['data']['type']);
return $document;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.