diff --git a/core/modules/rest/src/Routing/ResourceRoutes.php b/core/modules/rest/src/Routing/ResourceRoutes.php index 7bae458..f3e64bd 100644 --- a/core/modules/rest/src/Routing/ResourceRoutes.php +++ b/core/modules/rest/src/Routing/ResourceRoutes.php @@ -128,7 +128,7 @@ protected function getRoutesForResourceConfig(RestResourceConfigInterface $rest_ $route->setDefault('_rest_resource_config', $rest_resource_config->id()); $route->setOption('parameters', $route->getOption('parameters') + [ '_rest_resource_config' => [ - 'type' => $rest_resource_config->getEntityTypeId(), + 'type' => 'entity:' . $rest_resource_config->getEntityTypeId(), ], ]); $collection->add("rest.$name", $route); diff --git a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php index a0a94f1..a0256e4 100644 --- a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php +++ b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php @@ -42,12 +42,11 @@ class RequestHandlerTest extends KernelTestBase { */ public function setUp() { parent::setUp(); - $this->entityStorage = $this->prophesize(EntityStorageInterface::class); $config_factory = $this->prophesize(ConfigFactoryInterface::class); $config_factory->get('rest.settings') ->willReturn($this->prophesize(ImmutableConfig::class)->reveal()); $serializer = $this->prophesize(SerializerInterface::class); - $this->requestHandler = new RequestHandler($this->entityStorage->reveal(), $config_factory->reveal(), $serializer->reveal()); + $this->requestHandler = new RequestHandler($config_factory->reveal(), $serializer->reveal()); } /** @@ -67,18 +66,17 @@ public function testHandle() { $config->getCacheContexts()->willReturn([]); $config->getCacheTags()->willReturn([]); $config->getCacheMaxAge()->willReturn(12); - $this->entityStorage->load('restplugin')->willReturn($config->reveal()); // Response returns NULL this time because response from plugin is not // a ResourceResponse so it is passed through directly. - $response = $this->requestHandler->handle($route_match, $request, 'restplugin'); + $response = $this->requestHandler->handle($route_match, $request, $config->reveal()); $this->assertEquals(NULL, $response); // Response will return a ResourceResponse this time. $response = new ResourceResponse([]); $resource->get(NULL, $request) ->willReturn($response); - $handler_response = $this->requestHandler->handle($route_match, $request, 'restplugin'); + $handler_response = $this->requestHandler->handle($route_match, $request, $config->reveal()); $this->assertEquals($response, $handler_response); // We will call the patch method this time. @@ -88,7 +86,7 @@ public function testHandle() { $resource->patch(NULL, $request) ->shouldBeCalledTimes(1) ->willReturn($response); - $handler_response = $this->requestHandler->handle($route_match, $request, 'restplugin'); + $handler_response = $this->requestHandler->handle($route_match, $request, $config->reveal()); $this->assertEquals($response, $handler_response); }