You are here

protected function ResourceTestBase::getExpectedGetIndividualResourceResponse in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedGetIndividualResourceResponse()

Gets the expected individual ResourceResponse for GET.

Return value

\Drupal\jsonapi\CacheableResourceResponse The expected individual ResourceResponse.

File

core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php, line 3299

Class

ResourceTestBase
Subclass this for every JSON:API resource type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedGetIndividualResourceResponse($status_code = 200) {
  $resource_response = new CacheableResourceResponse($this
    ->getExpectedDocument(), $status_code);
  $cacheability = new CacheableMetadata();
  $cacheability
    ->setCacheContexts($this
    ->getExpectedCacheContexts());
  $cacheability
    ->setCacheTags($this
    ->getExpectedCacheTags());
  return $resource_response
    ->addCacheableDependency($cacheability);
}