/**
  * @param string $request
  * @param array $params
  * @param string $data
  */
 protected function buildDialogue($request, array $params, $data = '')
 {
     $this->client->expects($this->once())->method('get')->with($this->getUrl($request, $params))->will($this->returnValue($this->request));
     $this->request->expects($this->once())->method('setHeader')->with('User-Agent', $this->app_code)->will($this->returnValue($this->request));
     $this->request->expects($this->once())->method('send')->will($this->returnValue($this->response));
     $this->response->expects($this->once())->method('isError')->will($this->returnValue(!$data));
     if ($data) {
         $this->response->expects($this->once())->method('getBody')->with(true)->will($this->returnValue(gzencode($data)));
         $this->response_repair->expects($this->once())->method('repair')->with($data)->will($this->returnValue($data));
     } else {
         $this->response->expects($this->never())->method('getBody');
         $this->response_repair->expects($this->never())->method('repair');
     }
 }