// Response will return a ResourceResponse this time.
$response =
new ResourceResponse([]);
$resource->
get(NULL,
$request) ->
willReturn($response);
$handler_response =
$this->requestHandler->
handle($route_match,
$request,
$config->
reveal());
$this->
assertEquals($response,
$handler_response);
// We will call the patch method this time.
$route_match =
new RouteMatch('test',
(new Route('/rest/test',
['_rest_resource_config' => 'restplugin', 'example_original' => ''
],
['_content_type_format' => 'json'
]))->
setMethods(['PATCH'
]));
$request->
setMethod('PATCH'
);
$response =
new ResourceResponse([]);
$resource->
patch(['this is an array'
],
$request) ->
shouldBeCalledTimes(1
) ->
willReturn($response);
$handler_response =
$this->requestHandler->
handle($route_match,
$request,
$config->
reveal());
$this->
assertEquals($response,
$handler_response);
}}/**
* Stub class where we can prophesize methods.
*/