protected function ResourceResponseValidatorTest::createRequest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::createRequest()
- 9 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.
2 calls to ResourceResponseValidatorTest::createRequest()
- ResourceResponseValidatorTest::testDoValidateResponse in core/
modules/ jsonapi/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseValidatorTest.php - @covers ::doValidateResponse
- 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 216
Class
- ResourceResponseValidatorTest
- @coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator @group jsonapi
Namespace
Drupal\Tests\jsonapi\Unit\EventSubscriberCode
protected function createRequest($route_name, ResourceType $resource_type) {
$request = new Request();
$request->attributes
->set(RouteObjectInterface::ROUTE_NAME, $route_name);
$request->attributes
->set(Routes::RESOURCE_TYPE_KEY, $resource_type);
return $request;
}