protected function JsonApiDocumentTopLevelNormalizerTest::decorateRequest in JSON:API 8.2
Same name and namespace in other branches
- 8 tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\JsonApiDocumentTopLevelNormalizerTest::decorateRequest()
Decorates a request with sparse fieldsets and includes.
File
- tests/
src/ Kernel/ Normalizer/ JsonApiDocumentTopLevelNormalizerTest.php, line 721
Class
- JsonApiDocumentTopLevelNormalizerTest
- @coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer @group jsonapi @group legacy
Namespace
Drupal\Tests\jsonapi\Kernel\NormalizerCode
protected function decorateRequest(Request $request, array $fields = NULL, array $includes = NULL) {
$parameters = new ParameterBag();
$parameters
->add($fields ? [
'fields' => $fields,
] : []);
$parameters
->add($includes ? [
'include' => $includes,
] : []);
$request->query = $parameters;
return $request;
}