Zendesk\API\UnitTests\BasicTest::mockApiResponses PHP Method

mockApiResponses() protected method

This will mock the next responses sent via guzzle
protected mockApiResponses ( array $responses = [] )
$responses array An array of GuzzleHttp\Psr7\Response objects
    protected function mockApiResponses($responses = [])
    {
        if (empty($responses)) {
            return;
        } elseif (!is_array($responses)) {
            $responses = [$responses];
        }
        $history = Middleware::history($this->mockedTransactionsContainer);
        $mock = new MockHandler($responses);
        $handler = HandlerStack::create($mock);
        $handler->push($history);
        $this->client->guzzle = new Client(['handler' => $handler]);
    }