You are here

protected function ResourceResponseTestTrait::getRelationshipResponses in Drupal 9

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

Gets an array of relationship responses for the given field names.

Parameters

array $relationship_field_names: The list of relationship field names for which to get responses.

array $request_options: Request options to apply.

Return value

array The relationship responses, keyed by relationship field names.

See also

\GuzzleHttp\ClientInterface::request()

1 call to ResourceResponseTestTrait::getRelationshipResponses()
ResourceTestBase::doTestRelationshipGet in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Performs one round of relationship route testing.

File

core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php, line 454

Class

ResourceResponseTestTrait
Utility methods for handling resource responses.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getRelationshipResponses(array $relationship_field_names, array $request_options) {
  $links = array_map(function ($relationship_field_name) {
    return static::getRelationshipLink(static::toResourceIdentifier($this->entity), $relationship_field_name);
  }, array_combine($relationship_field_names, $relationship_field_names));
  return $this
    ->getResponses($links, $request_options);
}