guzzlehttp / test-server
Node.js 服务器和 PHP 控制器
0.1.0
2021-10-06 02:56 UTC
Requires
- php: ^7.2.5 || ^8.0
- guzzlehttp/guzzle: ^7.3
README
此服务器一直是 Guzzle Http 客户端的一部分。自 2021 年底以来,它被提取到自己的包中。
此服务器在集成测试中非常有用。
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