function ResourceTestBase::getPatchDocument
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getPatchDocument()
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getPatchDocument()
- 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getPatchDocument()
Returns the JSON:API PATCH document.
By default, reuses ::getPostDocument(), which works fine for most entity types. A counter example: the 'comment' entity type.
Return value
array A JSON:API request document.
See also
::testPatchIndividual()
1 call to ResourceTestBase::getPatchDocument()
- ResourceTestBase::testPatchIndividual in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests PATCHing an individual resource, plus edge cases to ensure good DX.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 465
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getPatchDocument() {
return NestedArray::mergeDeep([
'data' => [
'id' => $this->entity
->uuid(),
],
], $this->getPostDocument());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.