protected function ResourceResponseTestTrait::getResponses in Drupal 10
Same name and namespace in other branches
- 8 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::getResponses()
- 9 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::getResponses()
Gets responses from an array of links.
Parameters
array $links: A keyed array of links.
array $request_options: Request options to apply.
Return value
array The fetched array of responses, keys are preserved.
See also
\GuzzleHttp\ClientInterface::request()
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceResponseTestTrait.php, line 474
Class
- ResourceResponseTestTrait
- Utility methods for handling resource responses.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getResponses(array $links, array $request_options) {
return array_reduce(array_keys($links), function ($related_responses, $key) use ($links, $request_options) {
$related_responses[$key] = $this
->request('GET', Url::fromUri($links[$key]), $request_options);
return $related_responses;
}, []);
}