You are here

protected function ResourceTestBase::getPatchDocument in Drupal 9

Same name and namespace in other branches
  1. 8 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 467

Class

ResourceTestBase
Subclass this for every JSON:API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getPatchDocument() {
  return NestedArray::mergeDeep([
    'data' => [
      'id' => $this->entity
        ->uuid(),
    ],
  ], $this
    ->getPostDocument());
}