protected function ResourceResponseSubscriberTest::getFunctioningResourceResponseSubscriber in Drupal 8
Same name and namespace in other branches
- 9 core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php \Drupal\Tests\rest\Unit\EventSubscriber\ResourceResponseSubscriberTest::getFunctioningResourceResponseSubscriber()
- 10 core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php \Drupal\Tests\rest\Unit\EventSubscriber\ResourceResponseSubscriberTest::getFunctioningResourceResponseSubscriber()
Return value
\Drupal\rest\EventSubscriber\ResourceResponseSubscriber
3 calls to ResourceResponseSubscriberTest::getFunctioningResourceResponseSubscriber()
- ResourceResponseSubscriberTest::testOnResponseWithCacheableResponse in core/
modules/ rest/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseSubscriberTest.php - @covers ::onResponse @covers ::getResponseFormat @covers ::renderResponseBody @covers ::flattenResponse
- ResourceResponseSubscriberTest::testOnResponseWithUncacheableResponse in core/
modules/ rest/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseSubscriberTest.php - @covers ::onResponse @covers ::getResponseFormat @covers ::renderResponseBody @covers ::flattenResponse
- ResourceResponseSubscriberTest::testSerialization in core/
modules/ rest/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseSubscriberTest.php - @covers ::onResponse @dataProvider providerTestSerialization
File
- core/
modules/ rest/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseSubscriberTest.php, line 387
Class
- ResourceResponseSubscriberTest
- @coversDefaultClass \Drupal\rest\EventSubscriber\ResourceResponseSubscriber @group rest
Namespace
Drupal\Tests\rest\Unit\EventSubscriberCode
protected function getFunctioningResourceResponseSubscriber(RouteMatchInterface $route_match) {
// Create a dummy of the renderer service.
$renderer = $this
->prophesize(RendererInterface::class);
$renderer
->executeInRenderContext(Argument::type(RenderContext::class), Argument::type('callable'))
->will(function ($args) {
$callable = $args[1];
return $callable();
});
// Instantiate the ResourceResponseSubscriber we will test.
$resource_response_subscriber = new ResourceResponseSubscriber(new Serializer([], [
new JsonEncoder(),
new XmlEncoder(),
]), $renderer
->reveal(), $route_match);
return $resource_response_subscriber;
}