// After saving the entity the normalization should not be cached.
$this->
assertFalse($cache);
// @todo Remove line below in favor of commented line in https://www.drupal.org/project/drupal/issues/2878463.
$url = Url::
fromRoute(sprintf('jsonapi.%s.individual',
static::
$resourceTypeName),
['entity' =>
$uuid]);
// $url = $this->entity->toUrl('jsonapi');
$request_options =
$this->
getAuthenticationRequestOptions();
$request_options[RequestOptions::QUERY
] =
['fields' =>
['node--camelids' => 'title'
]];
$this->
request('GET',
$url,
$request_options);
// Ensure the normalization cache is being incrementally built. After
// requesting the title, only the title is in the cache.
$this->
assertNormalizedFieldsAreCached(['title'
]);
$request_options[RequestOptions::QUERY
] =
['fields' =>
['node--camelids' => 'field_rest_test'
]];
$this->
request('GET',
$url,
$request_options);
// After requesting an additional field, then that field is in the cache and
// the old one is still there.
$this->
assertNormalizedFieldsAreCached(['title', 'field_rest_test'
]);
} /**
* Checks that the provided field names are the only fields in the cache.
*
* The normalization cache should only have these fields, which build up
* across responses.
*
* @param string[] $field_names
* The field names.
*
* @internal
*/