Exemplo n.º 1
0
 function it_maps_declined_response_402_to_payment_result_object(ClientException $exception, Response $response, ResultObjectMapperInterface $resultMapper, MethodInterface $method)
 {
     $result = ['error' => 'Error string'];
     $resultObject = new Payment();
     $response->getStatusCode()->willReturn(402);
     $response->json()->willReturn($result);
     $method->createResultObject()->willReturn($resultObject);
     $exception->getResponse()->willReturn($response);
     $resultMapper->map($result, $resultObject)->shouldBeCalled()->willReturn($resultObject);
     $this->get($exception, $method)->getResult()->shouldReturn($resultObject);
 }
Exemplo n.º 2
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);
 }