diff --git a/composer.json b/composer.json index c83557c93..7db191e65 100644 --- a/composer.json +++ b/composer.json @@ -103,12 +103,12 @@ "extra": { "downloads": { "pact-ffi-headers": { - "version": "0.4.11", + "version": "0.4.12", "url": "https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v{$version}/pact.h", "path": "bin/pact-ffi-headers/pact.h" }, "pact-ffi-lib": { - "version": "0.4.11", + "version": "0.4.12", "variables": { "{$prefix}": "PHP_OS_FAMILY === 'Windows' ? 'pact_ffi' : 'libpact_ffi'", "{$os}": "PHP_OS === 'Darwin' ? 'osx' : strtolower(PHP_OS_FAMILY)", diff --git a/example/matchers/consumer/tests/Service/MatchersTest.php b/example/matchers/consumer/tests/Service/MatchersTest.php index fb02ef632..df756ac4f 100644 --- a/example/matchers/consumer/tests/Service/MatchersTest.php +++ b/example/matchers/consumer/tests/Service/MatchersTest.php @@ -40,6 +40,22 @@ public function testGetMatchers(): void $response ->setStatus($this->matcher->statusCode(HttpStatus::SERVER_ERROR, 512)) ->addHeader('Content-Type', 'application/json') + ->addHeader('X-IMPROVED', [ + $this->matcher->values([ + 'like', + 'regex', + 'values', + 'arrayContaining', + ]), + ]) + ->addHeader('X-REMOVED', [ + $this->matcher->arrayContaining([ + 'ipv4AddressV3', + 'ipv6AddressV3', + 'emailV3', + 'statusCode', + ]), + ]) ->setBody([ 'like' => $this->matcher->like(['key' => 'value']), 'likeNull' => $this->matcher->like(null), diff --git a/example/matchers/pacts/matchersConsumer-matchersProvider.json b/example/matchers/pacts/matchersConsumer-matchersProvider.json index a9f8dce85..72b7530c1 100644 --- a/example/matchers/pacts/matchersConsumer-matchersProvider.json +++ b/example/matchers/pacts/matchersConsumer-matchersProvider.json @@ -29,21 +29,21 @@ ] }, "query": { - "$.pages": { + "locales[]": { "combine": "AND", "matchers": [ { "match": "regex", - "regex": "\\d+" + "regex": "^[a-z]{2}-[A-Z]{2}$" } ] }, - "$['locales[]']": { + "pages": { "combine": "AND", "matchers": [ { "match": "regex", - "regex": "^[a-z]{2}-[A-Z]{2}$" + "regex": "\\d+" } ] } @@ -159,6 +159,15 @@ "headers": { "Content-Type": [ "application/json" + ], + "X-IMPROVED": [ + "like", + "regex", + "values", + "arrayContaining" + ], + "X-REMOVED": [ + "" ] }, "matchingRules": { @@ -570,7 +579,78 @@ ] } }, - "header": {}, + "header": { + "X-IMPROVED": { + "combine": "AND", + "matchers": [ + { + "match": "values" + } + ] + }, + "X-REMOVED": { + "combine": "AND", + "matchers": [ + { + "match": "arrayContains", + "variants": [ + { + "index": 0, + "rules": { + "": { + "combine": "AND", + "matchers": [ + { + "match": "equality" + } + ] + } + } + }, + { + "index": 0, + "rules": { + "": { + "combine": "AND", + "matchers": [ + { + "match": "equality" + } + ] + } + } + }, + { + "index": 0, + "rules": { + "": { + "combine": "AND", + "matchers": [ + { + "match": "equality" + } + ] + } + } + }, + { + "index": 0, + "rules": { + "": { + "combine": "AND", + "matchers": [ + { + "match": "equality" + } + ] + } + } + } + ] + } + ] + } + }, "status": { "$": { "combine": "AND", @@ -591,9 +671,9 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.11", + "ffi": "0.4.12", "mockserver": "1.2.4", - "models": "1.1.12" + "models": "1.1.14" }, "pactSpecification": { "version": "4.0" diff --git a/example/matchers/provider/public/index.php b/example/matchers/provider/public/index.php index 87fde2982..420e929f5 100644 --- a/example/matchers/provider/public/index.php +++ b/example/matchers/provider/public/index.php @@ -91,7 +91,19 @@ return $response ->withHeader('Content-Type', 'application/json') - ->withStatus(503); + ->withStatus(503) + ->withHeader('X-IMPROVED', [ + 'regex', + 'like', + 'values', + 'arrayContaining', + ]) + ->withHeader('X-REMOVED', [ + 'ipv4AddressV3', + 'ipv6AddressV3', + 'emailV3', + 'statusCode', + ]); }); $app->post('/pact-change-state', function (Request $request, Response $response) {