Skip to content

Commit

Permalink
Merge pull request #346 from tienvx/remove-stub-server-http-service
Browse files Browse the repository at this point in the history
Use Rust FFI #15: Remove StubServerHttpService
  • Loading branch information
YOU54F committed Oct 12, 2023
2 parents 4d61608 + f121fb2 commit 8f2da63
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 8f2da63

Please sign in to comment.