function ResourceResponseValidatorTest::createRequest
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::createRequest()
- 8.9.x core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::createRequest()
- 11.x core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::createRequest()
Helper method to create a request object.
Parameters
string $route_name: The route name with which to construct a request.
\Drupal\jsonapi\ResourceType\ResourceType $resource_type: The resource type for the requested route.
Return value
\Symfony\Component\HttpFoundation\Request The mock request object.
1 call to ResourceResponseValidatorTest::createRequest()
- 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 174
Class
- ResourceResponseValidatorTest
- @coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator @group jsonapi
Namespace
Drupal\Tests\jsonapi\Unit\EventSubscriberCode
protected static function createRequest(string $route_name, ResourceType $resource_type) : Request {
$request = new Request();
$request->attributes
->set(RouteObjectInterface::ROUTE_NAME, $route_name);
$request->attributes
->set(Routes::RESOURCE_TYPE_KEY, $resource_type);
return $request;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.