/** * @param \GuzzleHttp\Message\RequestInterface $request * @param \GuzzleHttp\Message\ResponseInterface|null $response * @param boolean $ignoreBody */ private function log(\GuzzleHttp\Message\RequestInterface $request, \GuzzleHttp\Message\ResponseInterface $response = null, $ignoreBody = false) { if ($this->logger === null) { return; } $this->logger->log($this->getZboziApiRequest($request), $response === null ? null : $this->getZboziApiResponse($response, $ignoreBody)); }
/** * @expectedException \SlevomatZboziApi\Response\ResponseErrorException * @expectedExceptionMessage Slevomat API invalid response: invalid JSON data. */ public function testResponseErrorExceptionIsThrownForResponseWithInvalidJsonData() { $this->loggerMock->expects(self::once())->method('log'); $this->httpClientMock->expects(self::once())->method('send')->willReturn(new \GuzzleHttp\Psr7\Response(200, [], '{"someData":xxx}')); $requestMaker = $this->createRequestMaker(); $requestMaker->sendPostRequest('someUrl'); }