You are here

protected function ResourceTestBase::getExpectedGetIndividualResourceResponse in JSON:API 8

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

Gets the expected individual ResourceResponse for GET.

1 call to ResourceTestBase::getExpectedGetIndividualResourceResponse()
ResourceTestBase::getExpectedIncludeResponse in tests/src/Functional/ResourceTestBase.php
Gets an expected ResourceResponse with includes for the given field set.

File

tests/src/Functional/ResourceTestBase.php, line 2691

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