You are here

protected function ResourceTestBase::getExpectedGetIndividualResourceResponse in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedGetIndividualResourceResponse()
  2. 10 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\ResourceResponse The expected individual ResourceResponse.

File

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

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 ResourceResponse($this
    ->getExpectedDocument(), $status_code);
  $cacheability = new CacheableMetadata();
  $cacheability
    ->setCacheContexts($this
    ->getExpectedCacheContexts());
  $cacheability
    ->setCacheTags($this
    ->getExpectedCacheTags());
  return $resource_response
    ->addCacheableDependency($cacheability);
}