Beispiel #1
0
 /**
  * {@inheritDoc}
  */
 public function request($path, $body, $httpMethod = 'GET', array $headers = array(), array $options = array())
 {
     if (!empty($this->options['debug'])) {
         $options['debug'] = $this->options['debug'];
     }
     if (count($headers) > 0) {
         $options['headers'] = $headers;
     }
     $options['body'] = $body;
     $request = $this->client->createRequest($httpMethod, $path, $options);
     try {
         $response = $this->client->send($request);
     } catch (\Exception $e) {
         $this->errorHandler->onException($e);
     }
     return $response;
 }
 /**
  * @test
  * @expectedException Uphold\Exception\RuntimeException
  */
 public function shouldThrowRuntimeExceptionWhenStatusCodeIs500()
 {
     $request = $this->getRequestMock();
     $response = new Response(500);
     $errorHandler = new ErrorHandler();
     $errorHandler->onException(new RequestException('500 error', $request, $response));
 }