function ResourceTestBase::getPatchDocument
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getPatchDocument()
- 8.9.x 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::doTestPatchIndividual in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests PATCHing an individual resource, plus edge cases to ensure good DX.
2 methods override ResourceTestBase::getPatchDocument()
- UserTest::getPatchDocument in core/
modules/ jsonapi/ tests/ src/ Functional/ UserTest.php - Returns the JSON:API PATCH document.
- WorkspaceTest::getPatchDocument in core/
modules/ jsonapi/ tests/ src/ Functional/ WorkspaceTest.php - Returns the JSON:API PATCH document.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 474
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.