Example #1
0
 function it_maps_result_containing_collection_of_items(MethodResultCollectionInterface $method, ClientInterface $client, ValidatorInterface $validator, ResultObjectMapperInterface $mapper)
 {
     $result = [['id' => '3c4e8dcf']];
     $resultObject = new Payment();
     $method->getMethod()->willReturn('POST');
     $method->getAction()->willReturn('payment');
     $method->getAttributes()->willReturn([]);
     $method->createResultObject()->willReturn($resultObject);
     $validator->validate($method)->shouldBeCalled();
     $mapper->mapCollection($result, $method)->shouldBeCalled()->willReturn([$resultObject]);
     $client->sendRequest($method, 'POST', 'payment', ['headers' => ['Content-Type' => 'application/json'], 'body' => '{}'])->shouldBeCalled()->willReturn($result);
     $this->call($method)->shouldReturn([$resultObject]);
 }