andykelk/pact-php

add functionality to overwrite pact

nixpad opened this issue · 1 comments

Something like pact file write mode, else when you rerun a test that has an existing interaction, it fails with error:

 ERROR -- : An interaction with same description ("a request for all variations") and provider state ("a variation exists") but a different response body has already been used. Please use a different description or provider state.

This is implemented in version 0.2.1

To use, add an extra parameter to the constructor for MockService:

$alligatorProvider = Pact::mockService([
  'consumer' => 'Alligator Consumer',
  'provider' => 'Alligator Provider',
  'port' => 1234,
  'pactfile_write_mode' => 'update'
]);

Options are update or overwrite (which is the default if not provided).