/** * @param Response[] $responses * * @return $this * @throws \Exception */ protected function mockResponses($responses) { Client::getInstance()->setDefaultOption('handler', HandlerStack::create(new MockHandler($responses))); return $this; }
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); }
/** * AbstractAPI constructor. */ public function __construct() { $this->client = Client::getInstance(); }