Skip to content

Commit

Permalink
chore: Remove StubServerHttpService
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Oct 9, 2023
1 parent d87ffec commit f121fb2
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 209 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,9 @@ $config = (new StubServerConfig())
$stubServer = new StubServer($config);
$stubServer->start();

$service = new StubServerHttpService(new GuzzleClient(), $config);
$client = new \GuzzleHttp\Client();

echo $service->getJson($endpoint); // output: {"results":[{"name":"Games"}]}
$response = $client->get($this->config->getBaseUri() . '/' . $endpoint);

echo $response->getBody(); // output: {"results":[{"name":"Games"}]}
```
7 changes: 4 additions & 3 deletions UPGRADE-10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ This migrates from a CLI driven process for the Pact Framework, to an FFI proces
- Stub Server

- No longer defaults to port 7201, picks free port at random.
- Endpoint now can be set by:
- `PhpPact\Standalone\StubService\Service\StubServerHttpService` is no longer available. Guzzle can be used to request to stub server directly:

```php
$service = new StubServerHttpService(new GuzzleClient(), $this->config);
$service->getJson($endpoint);
$client = new \GuzzleHttp\Client();
$response = $client->get($this->config->getBaseUri() . '/' . $endpoint);
echo $response->getBody();
```

- Example Migrations to 10.x (Pull Request Diffs)
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ext-json": "*",
"composer/semver": "^1.4.0|^3.2.0",
"symfony/process": "^4.4|^5.4|^6.0",
"guzzlehttp/guzzle": "^6.5.8|^7.4.5",
"guzzlehttp/psr7": "^2.4.5",
"tienvx/composer-downloads-plugin": "^1.2.0"
},
"require-dev": {
Expand All @@ -32,7 +32,8 @@
"friendsofphp/php-cs-fixer": "^3.0",
"php-amqplib/php-amqplib": "^3.0",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": ">=8.5.23 <10"
"phpunit/phpunit": ">=8.5.23 <10",
"guzzlehttp/guzzle": "^7.8"
},
"autoload": {
"psr-4": {
Expand Down
37 changes: 0 additions & 37 deletions src/PhpPact/Http/ClientInterface.php

This file was deleted.

60 changes: 0 additions & 60 deletions src/PhpPact/Http/GuzzleClient.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit f121fb2

Please sign in to comment.