You are here

protected function UserTest::makeNormalizationInvalid in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::makeNormalizationInvalid()

Makes the given JSON:API document invalid.

Parameters

array $document: A JSON:API document.

string $entity_key: The entity key whose normalization to make invalid.

Return value

array The updated JSON:API document, now invalid.

Overrides ResourceTestBase::makeNormalizationInvalid

File

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

Class

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

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function makeNormalizationInvalid(array $document, $entity_key) {
  if ($entity_key === 'label') {
    $document['data']['attributes']['name'] = [
      0 => $document['data']['attributes']['name'],
      1 => 'Second Title',
    ];
    return $document;
  }
  return parent::makeNormalizationInvalid($document, $entity_key);
}