Beispiel #1
0
 function it_performs_request_without_validation(MethodInterface $method, ClientInterface $client, ResultObjectMapperInterface $mapper)
 {
     $result = ['amount' => 50.0];
     $resultObject = new Payment();
     $method->getMethod()->willReturn('GET');
     $method->getAction()->willReturn('payment');
     $method->getAttributes()->willReturn(['field' => 'value']);
     $method->createResultObject()->willReturn($resultObject);
     $mapper->map($result, $resultObject)->shouldBeCalled()->willReturn($resultObject);
     $client->sendRequest($method, 'GET', 'payment', ['query' => ['field' => 'value']])->shouldBeCalled()->willReturn($result);
     $this->callNoValidate($method)->shouldReturn($resultObject);
 }
Beispiel #2
0
 function it_handles_unexpected_exceptions(MethodInterface $method, ClientInterface $client, RequestInterface $request, \Exception $exception)
 {
     $client->send($request)->willThrow($exception->getWrappedObject());
     $this->shouldThrow('Cardinity\\Exception\\UnexpectedError')->duringSendRequest($method, 'POST', 'https://api.cardinity.com/v1/');
 }