public function testGetUserByUsernameServerError()
 {
     $that = $this;
     $this->getMockHttpClient()->expects($this->once())->method('get')->will($this->returnValue($this->createMockRequest(function ($request) use($that) {
         return $that->throwException(ServerErrorResponseException::factory($request, $that->createMockResponse()));
     })));
     $this->setExpectedException('Guzzle\\Http\\Exception\\BadResponseException');
     $this->resource->getUserByUsername('test');
 }
 /**
  * @param \Guzzle\Http\Exception\ServerErrorResponseException $exception
  *
  * @throws \Searchperience\Common\Http\Exception\ServerErrorResponseException
  * @throws \Searchperience\Common\Http\Exception\InternalServerErrorException
  * @return void
  */
 protected function transformStatusCodeToServerErrorResponseException(\Guzzle\Http\Exception\ServerErrorResponseException $exception)
 {
     switch ($exception->getResponse()->getStatusCode()) {
         case 500:
             $e = new \Searchperience\Common\Http\Exception\InternalServerErrorException($exception->getMessage(), 1353574974, $exception);
             $e->setResponse($exception->getResponse());
             throw $e;
             break;
         default:
             $e = new \Searchperience\Common\Http\Exception\ServerErrorResponseException($exception->getMessage(), 1353574979, $exception);
             $e->setResponse($exception->getResponse());
             throw $e;
     }
 }
Esempio n. 3
0
 /**
  * @return ServerErrorResponseException
  */
 private function createGuzzleServerErrorResponseException()
 {
     $e = new ServerErrorResponseException();
     $response = new GuzzleResponse(500);
     $e->setResponse($response);
     return $e;
 }