You are here

protected function ResourceTestBase::getPatchDocument in JSON:API 8

Same name and namespace in other branches
  1. 8.2 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 tests/src/Functional/ResourceTestBase.php
Tests PATCHing an individual resource, plus edge cases to ensure good DX.

File

tests/src/Functional/ResourceTestBase.php, line 408

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());
}