/**
  * @param Response[] $responses
  *
  * @return $this
  * @throws \Exception
  */
 protected function mockResponses($responses)
 {
     Client::getInstance()->setDefaultOption('handler', HandlerStack::create(new MockHandler($responses)));
     return $this;
 }
예제 #2
0
 public function testStreamAPIWithFailedResponse()
 {
     Client::getInstance()->setDefaultOption('handler', HandlerStack::create(new MockHandler([new Response(500, ['Content-Type' => 'application/text'], 'ok')])));
     Client::getInstance()->request('GET', '/', ['query' => ['ok' => 'ok']], true, true);
 }
예제 #3
0
 /**
  * AbstractAPI constructor.
  */
 public function __construct()
 {
     $this->client = Client::getInstance();
 }