You are here

protected static function ResourceResponseTestTrait::toResourceResponses in JSON:API 8

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

Maps an array of PSR responses to JSON API ResourceResponses.

Parameters

\Psr\Http\Message\ResponseInterface[] $responses: The PSR responses to be mapped.

Return value

\Drupal\jsonapi\ResourceResponse[] The ResourceResponses.

3 calls to ResourceResponseTestTrait::toResourceResponses()
ResourceResponseTestTrait::getExpectedIncludedResourceResponse in tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of expected ResourceResponses for the given include paths.
ResourceTestBase::getExpectedCollectionResponse in tests/src/Functional/ResourceTestBase.php
Returns a JSON API collection document for the expected entities.
ResourceTestBase::getExpectedRelatedResponses in tests/src/Functional/ResourceTestBase.php
Builds an array of expected related ResourceResponses, keyed by field name.

File

tests/src/Functional/ResourceResponseTestTrait.php, line 190

Class

ResourceResponseTestTrait
Utility methods for handling resource responses.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected static function toResourceResponses(array $responses) {
  return array_map([
    self::class,
    'toResourceResponse',
  ], $responses);
}