You are here

protected function ResourceTestBase::getPatchDocument in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getPatchDocument()
  2. 10 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\Functional

Code

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