pact-foundation / pact-php

PHP version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project
Apache License 2.0
271 stars 92 forks source link

feat: Allow combining matchers #597

Closed tienvx closed 4 months ago

tienvx commented 4 months ago

Implemented this feature https://github.com/pact-foundation/pact-reference/pull/405

mefellows commented 4 months ago

Nice! Wow you got onto this feature quickly, I need to get my head into how a consumer might look, ad perhaps try with Pact JS/Go to test it out.

Would a review early next week work or is that going to be too late for you?

tienvx commented 4 months ago

A review early next week would be great. I will focus on other things for now. Thanks

YOU54F commented 4 months ago

This looks great.

With regard to

Pact JVM supports combining matching rules using the AND logical expression.

I was just looking to how this is implemented

https://github.com/pact-foundation/pact-jvm/blob/master/consumer/junit/README.md#combining-matching-rules-with-andor

It looks to support AND and OR operators.

and with regard to naming of MatchAll, if we were to have the ability to do an OR operation, what would that be called.

ahhh looking further, it doesn't look like OR is supported as part of https://github.com/pact-foundation/pact-reference/pull/405

I just took a look at the matchers in pact-js and pact-go, to think about how the DSL would look. ie would be want to introduce a MatchAll function there. The pact-jvm DSL is clunkier for matcher bodies than other languages, so your approach might be preferable.

tienvx commented 4 months ago

ahhh looking further, it doesn't look like OR is supported

Yes, it doesn't support. But I assume it will support in the future, and I suggest matchAny for it.

tienvx commented 4 months ago

Self-reviewed