function ResourceResponseValidatorTest::createResponse
Same name in this branch
- 11.x core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::createResponse()
Same name and namespace in other branches
- 10 core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::createResponse()
- 9 core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::createResponse()
- 8.9.x core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\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.
File
-
core/
modules/ jsonapi/ tests/ modules/ jsonapi_response_validator/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseValidatorTest.php, line 194
Class
- ResourceResponseValidatorTest
- Tests Drupal\jsonapi_response_validator\EventSubscriber\ResourceResponseValidator.
Namespace
Drupal\Tests\jsonapi_response_validator\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.