protected function ResourceResponseTestTrait::getResponses in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::getResponses()
- 10 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()
5 calls to ResourceResponseTestTrait::getResponses()
- ResourceResponseTestTrait::getExpectedIncludedResourceResponse in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceResponseTestTrait.php - Gets an array of expected ResourceResponses for the given include paths.
- ResourceResponseTestTrait::getRelatedResponses in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceResponseTestTrait.php - Gets an array of related responses for the given field names.
- ResourceResponseTestTrait::getRelationshipResponses in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceResponseTestTrait.php - Gets an array of relationship responses for the given field names.
- ResourceTestBase::getExpectedCollectionResponse in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Returns a JSON:API collection document for the expected entities.
- ResourceTestBase::getExpectedRelatedResponse in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Builds an expected related ResourceResponse for the given field.
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;
}, []);
}