function UserTest::getPatchDocument

Same name and namespace in other branches
  1. 11.x core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::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.

Overrides ResourceTestBase::getPatchDocument

File

core/modules/jsonapi/tests/src/Functional/UserTest.php, line 201

Class

UserTest
JSON:API integration test for the "User" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getPatchDocument() {
  return [
    'data' => [
      'id' => $this->entity
        ->uuid(),
      'type' => 'user--user',
      'attributes' => [
        'name' => 'Drama llama 2',
      ],
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.