Skip to content

A node.js server and a PHP controller class one can use when testing

License

Notifications You must be signed in to change notification settings

guzzle/test-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

use GuzzleHttp\Server\Server;

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

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

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

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

About

A node.js server and a PHP controller class one can use when testing

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published