Skip to content

Commit 27fc82f

Browse files
committed
Added readme
1 parent 50c9c6f commit 27fc82f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Guzzle test server
2+
3+
This server has long been part of the Guzzle Http client. Since late 2021 it
4+
was extracted to its own package.
5+
6+
The server is useful to use in your integration tests.
7+
8+
```php
9+
10+
use GuzzleHttp\Server\Server;
11+
12+
Server::start();
13+
register_shutdown_function(static function () {
14+
Server::stop();
15+
});
16+
17+
Server::enqueue([
18+
new Response(201),
19+
]);
20+
21+
$myHttpClient = MyClient();
22+
$response = $this->makeRequest('GET', Sever::$url);
23+
// $response will be 201
24+
25+
$requests = Server::received();
26+
// $request[0] is the one sent by MyClient
27+
28+
```

0 commit comments

Comments
 (0)