function it_should_format_response_for_pact_retrieve(RequestInterface $request, ResponseInterface $response, ResponseFormatter $responseFormatter)
 {
     $providerName = 'providerB';
     $consumerName = 'consumerA';
     $version = 'latest';
     $tagName = 'prod';
     $this->requestBuilder->createRetrievePactRequest($this->baseUrl, $consumerName, $providerName, $version, $tagName)->willReturn($request);
     $this->client->sendRequest($request)->willReturn($response);
     $response->getStatusCode()->willReturn(200);
     $response->getHeader('X-Pact-Consumer-Version')->willReturn(['1.2.0']);
     $responseFormatter->format($response)->willReturn('a');
     $contract = $this->retrievePact($providerName, $consumerName, $version, $tagName, $responseFormatter, $responseFormatter);
     $contract->shouldHaveType(Contract::class);
     $contract->data()->shouldReturn('a');
     $contract->version()->shouldReturn('1.2.0');
 }
 /**
  * Retrieves last added contract to the broker for all providers.
  *
  * @param ResponseFormatter $responseFormatter
  *
  * @return Contract
  * @throws PactBrokerException
  */
 public function retrieveLastAddedPact(ResponseFormatter $responseFormatter = null)
 {
     $request = $this->requestBuilder->createRetrieveLastAddedPact($this->baseUrl);
     $response = $this->client->sendRequest($request);
     $this->checkIfResponseIsCorrect($response);
     return new Contract($response->getHeader('X-Pact-Consumer-Version') ? $response->getHeader('X-Pact-Consumer-Version')[0] : '', $responseFormatter ? $responseFormatter->format($response) : $response);
 }