function ResourceResponseValidatorTest::createResponse
Helper method to create a resource response from arbitrary JSON.
Parameters
string|null $json: The JSON with which to create a mock response.
Return value
\Drupal\rest\ResourceResponse The mock response object.
1 call to ResourceResponseValidatorTest::createResponse()
- ResourceResponseValidatorTest::validateResponseProvider in core/
modules/ jsonapi/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseValidatorTest.php  - Provides test cases for testValidateResponse.
 
File
- 
              core/
modules/ jsonapi/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseValidatorTest.php, line 190  
Class
- ResourceResponseValidatorTest
 - @coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator[[api-linebreak]] @group jsonapi
 
Namespace
Drupal\Tests\jsonapi\Unit\EventSubscriberCode
protected static function createResponse(?string $json = NULL) : ResourceResponse {
  $response = new ResourceResponse();
  if ($json) {
    $response->setContent($json);
  }
  return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.