You are here

protected function ResourceTestBase::removeResourceTypeFromDocument in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::removeResourceTypeFromDocument()

Makes the JSON API document violate the spec by omitting the resource type.

Parameters

array $document: A JSON API document.

Return value

array The same JSON API document, without its resource type.

1 call to ResourceTestBase::removeResourceTypeFromDocument()
ResourceTestBase::testPostIndividual in tests/src/Functional/ResourceTestBase.php
Tests POSTing an individual resource, plus edge cases to ensure good DX.

File

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

Class

ResourceTestBase
Subclass this for every JSON API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function removeResourceTypeFromDocument(array $document) {
  unset($document['data']['type']);
  return $document;
}