Skip to content

Commit

Permalink
Added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Oct 6, 2021
1 parent 50c9c6f commit 27fc82f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Guzzle test server

This server has long been part of the Guzzle Http client. Since late 2021 it
was extracted to its own package.

The server is useful to use in your integration tests.

```php

use GuzzleHttp\Server\Server;

Server::start();
register_shutdown_function(static function () {
Server::stop();
});

Server::enqueue([
new Response(201),
]);

$myHttpClient = MyClient();
$response = $this->makeRequest('GET', Sever::$url);
// $response will be 201

$requests = Server::received();
// $request[0] is the one sent by MyClient

```

0 comments on commit 27fc82f

Please sign in to comment.