private function expectRequestFlow($method, $url, Response $response, $parser) { $return = (string) $response->getBody(); if ($parser === 'expectJson') { $return = json_decode($return, true); } $this->expectRequest($method, $url, $response); $this->parser->expects($this->once())->method($parser)->with($this->equalTo($response))->will($this->returnValue($return)); }
public function expectJson(Response $response) { // application/json return json_decode((string) $response->getBody(), true); }
public function handleResponse(Response $response, $name) { return $this->decoder->decode((string) $response->getBody(), $name); }