/** * Format response. * * @param MessageInterface $response * * @return array */ public function getResponse(MessageInterface $response) { $result = []; if (null !== $response) { $responseStr = $this->parser->getBodyWithHeaders($response); $result = ['response' => $responseStr]; } return $result; }
function it_returns_a_formatted_response(MessageInterface $response, HttpParser $parser) { $parser->getBodyWithHeaders($response)->shouldBeCalled()->willReturn('{"data": {}}'); $this->getResponse($response)->shouldReturn(['response' => '{"data": {}}']); }