Skip to content

Commit

Permalink
Merge pull request pact-foundation#466 from tienvx/simplify-query-mat…
Browse files Browse the repository at this point in the history
…cher-examples

chore: No need manually json encode matcher
  • Loading branch information
tienvx authored Feb 10, 2024
2 parents dda2989 + 30d4b6f commit 7f634f1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions example/matchers/consumer/tests/Service/MatchersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ public function testGetMatchers(): void
->setMethod('GET')
->setPath($this->matcher->regex('/matchers', '^\/matchers$'))
->setQuery([
'pages' => [ // Consumer send multiple values, but provider receive single (last) value
json_encode($this->matcher->regex([1, 22], '\d+')),
],
'locales[]' => [ // Consumer send multiple values, provider receive all values
json_encode($this->matcher->regex(['en-US', 'en-AU'], '^[a-z]{2}-[A-Z]{2}$')),
],
'pages' => $this->matcher->regex([1, 22], '\d+'), // arrayContains, eachKey, eachValue matchers are not working with query
'locales[]' => $this->matcher->regex(['en-US', 'en-AU'], '^[a-z]{2}-[A-Z]{2}$'), // Use `locales[]` instead of `locales` syntax if provider use PHP language
])
->addHeader('Accept', 'application/json')
->addHeader('Theme', $this->matcher->regex('dark', 'light|dark')); // arrayContains, eachKey, eachValue matchers are not working with headers
Expand Down

0 comments on commit 7f634f1

Please sign in to comment.