You are here

protected function JsonApiDocumentTopLevelNormalizerTest::decorateRequest in Drupal 8

Decorates a request with sparse fieldsets and includes.

File

core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php, line 720

Class

JsonApiDocumentTopLevelNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer @group jsonapi

Namespace

Drupal\Tests\jsonapi\Kernel\Normalizer

Code

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;
}