Repository navigation
feat: add no pacts is error verification option - #840
Open
hidingmyname wants to merge 1 commit into
Open
hidingmyname wants to merge 1 commit into
hidingmyname wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #839
Adds a
noPactsIsErroroption toVerificationOptions, as discussed in #839, so a provider verification can succeed when the Pact Broker has no pacts for the provider. This is the same FFI setting pact-ruby exposes asfail_if_no_pacts_found.Changes
VerificationOptions/VerificationOptionsInterface:isNoPactsIsError()andsetNoPactsIsError(), defaulttrue.FFI\Client/FFI\ClientInterface: wrappactffi_verifier_set_no_pacts_is_error.Verifier: apply the option together with the other verification options.Compatibility: the default matches the default in
libpact_ffi(no_pacts_is_error: true), so current behaviour does not change.VerificationOptionsInterfaceandClientInterfacegain new methods, which would affect anyone implementing those interfaces themselves.Scope: in
libpact_ffithis setting only applies when the broker reports no pacts. Other load failures, such as a broker that cannot be reached or invalid pact files, still fail the verification.Tests
composer test: 1008 tests pass with this change. Without it, the 18 cases that call the new method fail (ClientTestandVerifierTest).ClientTestcalls the new function through the reallibpact_ffi0.5.10.composer lintandcomposer static-code-analysispass.I also ran
Verifier::verify()with the real library against a small local stub broker, once returning a 404 and once returning an empty pacts list. The results were the same for both:verify()falsesetNoPactsIsError(true)falsesetNoPactsIsError(false)trueWithout this change the default also returns
false. Tested with PHP 8.4.27, PHPUnit 11.5.57. I did not run this against a real Pact Broker.