respondFromApiResponse() public method

Send a JSON HTTP response based on the given API response
public respondFromApiResponse ( Elgg\Services\AjaxResponse $api_response, string $hook_type = '' ) : Symfony\Component\HttpFoundation\JsonResponse
$api_response Elgg\Services\AjaxResponse API response
$hook_type string The hook type. If given, the response will be filtered by hook
return Symfony\Component\HttpFoundation\JsonResponse
Exemplo n.º 1
0
 public function testCanNotSendANewResponseAfterAjaxResponseFromApiResponseIsSent()
 {
     $service = $this->createService();
     $api_response = new \Elgg\Ajax\Response();
     $api_response->setData((object) ['value' => 'foo']);
     ob_start();
     $json_response = $this->ajax->respondFromApiResponse($api_response);
     ob_get_clean();
     $this->assertEquals($json_response, $service->send($service->prepareResponse('bar')));
 }