Skip to content

Commit 0f69dad

Browse files
committed
test(compatibility-suite): Implement V3 scenarios
1 parent 556ec04 commit 0f69dad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1876
-1
lines changed

.github/workflows/compatibility-suite.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,19 @@ jobs:
3838

3939
- name: Run Behat
4040
run: vendor/bin/behat compatibility-suite/pact-compatibility-suite/features/V2
41+
v3:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
with:
46+
submodules: recursive
47+
48+
- uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: 8.2
51+
coverage: none
52+
53+
- uses: ramsey/composer-install@v2
54+
55+
- name: Run Behat
56+
run: vendor/bin/behat compatibility-suite/pact-compatibility-suite/features/V3

behat.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ imports:
33
- 'compatibility-suite/suites/v1/http/provider.yml'
44
- 'compatibility-suite/suites/v2/http/consumer.yml'
55
- 'compatibility-suite/suites/v2/http/provider.yml'
6+
- 'compatibility-suite/suites/v3/http/consumer.yml'
7+
- 'compatibility-suite/suites/v3/http/provider.yml'
8+
- 'compatibility-suite/suites/v3/message/consumer.yml'
9+
- 'compatibility-suite/suites/v3/message/provider.yml'
10+
- 'compatibility-suite/suites/v3/generators.yml'
11+
- 'compatibility-suite/suites/v3/matching-rules.yml'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.json
2+
*.txt
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
use Psr\Http\Message\ResponseInterface as Response;
4+
use Psr\Http\Message\ServerRequestInterface as Request;
5+
use Slim\Factory\AppFactory;
6+
7+
require __DIR__ . '/../../../vendor/autoload.php';
8+
9+
$app = AppFactory::create();
10+
11+
$app->put('/request-generators', function (Request $request, Response $response) {
12+
file_put_contents(__DIR__ . '/body.json', $request->getBody()->getContents());
13+
file_put_contents(__DIR__ . '/headers.json', json_encode($request->getHeaders()));
14+
file_put_contents(__DIR__ . '/queryParams.json', json_encode($request->getQueryParams()));
15+
16+
return $response;
17+
});
18+
19+
$app->post('/return-provider-state-values', function (Request $request, Response $response) {
20+
$values = $request->getQueryParams();
21+
22+
$response->getBody()->write(json_encode($values));
23+
24+
return $response->withHeader('Content-Type', 'application/json');
25+
});
26+
27+
$app->any('{path:.*}', function ($request, $response, array $args) {
28+
file_put_contents(__DIR__ . '/path.txt', $args['path']);
29+
30+
return $response;
31+
});
32+
33+
$app->run();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
default:
2+
suites:
3+
v3_generators:
4+
paths:
5+
- '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/generators.feature'
6+
- '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/http_generators.feature'
7+
8+
contexts:
9+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\SetUpContext'
10+
- 'PhpPactTest\CompatibilitySuite\Context\V3\BodyGeneratorsContext':
11+
- '@body_validator'
12+
- 'PhpPactTest\CompatibilitySuite\Context\V3\RequestGeneratorsContext':
13+
- '@interaction_builder'
14+
- '@request_generator_builder'
15+
- '@interactions_storage'
16+
- '@pact_writer'
17+
- '@generator_server'
18+
- '@provider_verifier'
19+
- '@body_storage'
20+
- 'PhpPactTest\CompatibilitySuite\Context\V3\ResponseGeneratorsContext':
21+
- '@interaction_builder'
22+
- '@response_generator_builder'
23+
- '@interactions_storage'
24+
- '@server'
25+
- '@client'
26+
- '@body_storage'
27+
28+
services: PhpPactTest\CompatibilitySuite\ServiceContainer\V3
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
default:
2+
suites:
3+
v3_http_consumer:
4+
paths: [ '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/http_consumer.feature' ]
5+
6+
contexts:
7+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\SetUpContext'
8+
- 'PhpPactTest\CompatibilitySuite\Context\V3\Http\ConsumerContext':
9+
- '@interaction_builder'
10+
- '@pact_writer'
11+
- '@interactions_storage'
12+
13+
services: PhpPactTest\CompatibilitySuite\ServiceContainer\V3
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
default:
2+
suites:
3+
v3_http_provider:
4+
paths: [ '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/http_provider.feature' ]
5+
6+
contexts:
7+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\SetUpContext'
8+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\InteractionsContext':
9+
- '@interactions_storage'
10+
- '@request_matching_rule_builder'
11+
- '@response_matching_rule_builder'
12+
- '@matching_rules_storage'
13+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Transform\InteractionsContext':
14+
- '@interaction_builder'
15+
- '@matching_rules_storage'
16+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\ProviderStateContext':
17+
- '@provider_state_server'
18+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\ProviderContext':
19+
- '@server'
20+
- '@provider_verifier'
21+
- '@provider_state_server'
22+
- 'PhpPactTest\CompatibilitySuite\Context\V1\Http\ProviderContext':
23+
- '@server'
24+
- '@pact_writer'
25+
- '@pact_broker'
26+
- '@response_builder'
27+
- '@interactions_storage'
28+
- '@provider_verifier'
29+
- 'PhpPactTest\CompatibilitySuite\Context\V3\Http\ProviderContext':
30+
- '@pact_writer'
31+
- '@provider_state_server'
32+
- '@provider_verifier'
33+
34+
services: PhpPactTest\CompatibilitySuite\ServiceContainer\V3
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
default:
2+
suites:
3+
v3_matching_rules:
4+
paths:
5+
- '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/matching_rules.feature'
6+
- '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/http_matching.feature'
7+
8+
contexts:
9+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\SetUpContext'
10+
- 'PhpPactTest\CompatibilitySuite\Context\V3\RequestMatchingContext':
11+
- '@interaction_builder'
12+
- '@server'
13+
- '@client'
14+
- '@interactions_storage'
15+
- '@request_builder'
16+
- '@request_matching_rule_builder'
17+
18+
services: PhpPactTest\CompatibilitySuite\ServiceContainer\V3
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
default:
2+
suites:
3+
v3_message_consumer:
4+
paths: [ '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/message_consumer.feature' ]
5+
6+
contexts:
7+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\SetUpContext'
8+
- 'PhpPactTest\CompatibilitySuite\Context\V3\Message\ConsumerContext':
9+
- '@specification'
10+
- '@message_generator_builder'
11+
- '@parser'
12+
- '@body_validator'
13+
- '@body_storage'
14+
- '@fixture_loader'
15+
16+
services: PhpPactTest\CompatibilitySuite\ServiceContainer\V3
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
default:
2+
suites:
3+
v3_message_provider:
4+
paths: [ '%paths.base%/compatibility-suite/pact-compatibility-suite/features/V3/message_provider.feature' ]
5+
6+
contexts:
7+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\SetUpContext'
8+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\Hook\ProviderStateContext':
9+
- '@provider_state_server'
10+
- 'PhpPactTest\CompatibilitySuite\Context\Shared\ProviderContext':
11+
- '@server'
12+
- '@provider_verifier'
13+
- '@provider_state_server'
14+
- 'PhpPactTest\CompatibilitySuite\Context\V3\Message\ProviderContext':
15+
- '@server'
16+
- '@interaction_builder'
17+
- '@interactions_storage'
18+
- '@message_pact_writer'
19+
- '@provider_verifier'
20+
- '@parser'
21+
- '@fixture_loader'
22+
23+
services: PhpPactTest\CompatibilitySuite\ServiceContainer\V3
24+
25+
# filters:
26+
# tags: ~@wip

0 commit comments

Comments
 (0)