예제 #1
0
파일: Api.php 프로젝트: xabbuh/panda-client
 /**
  * {@inheritDoc}
  */
 protected function createHttpClient(Account $account, $cloudId)
 {
     $guzzleClient = new Client('https://' . $account->getApiHost() . '/v2');
     $httpClient = new HttpClient();
     $httpClient->setAccount($account);
     $httpClient->setCloudId($cloudId);
     $httpClient->setGuzzleClient($guzzleClient);
     return $httpClient;
 }
예제 #2
0
 private function createGuzzleMock($method, $statusCode = 200, $body = '')
 {
     $response = $this->getMockBuilder('Guzzle\\Http\\Message\\Response')->disableOriginalConstructor()->setMethods(array())->getMock();
     $response->expects($this->any())->method('getStatusCode')->will($this->returnValue($statusCode));
     $response->expects($this->any())->method('getBody')->with(true)->will($this->returnValue($body));
     $request = $this->getMockBuilder('Guzzle\\Http\\Message\\Request')->disableOriginalConstructor()->setMethods(array())->getMock();
     $request->expects($this->once())->method('send')->will($this->returnValue($response));
     $this->guzzleClient = $this->getMockBuilder('\\Guzzle\\Http\\Client')->getMock();
     $this->httpClient->setGuzzleClient($this->guzzleClient);
     $this->guzzleClient->expects($this->once())->method($method)->will($this->returnValue($request));
 }