jfalque/http-mock
最新稳定版本:v1.0.1
Composer 安装命令:
composer require jfalque/http-mock
包简介
Allows to create HTTP fixtures to mock tests
README 文档
README
A HTTP server mock for automated tests.
This package is archived and not maintained anymore.
Testing code that makes HTTP calls is not simple: you either need to setup an actual HTTP server that provides the exact responses your tests require, or create mocks with complex assertions and/or expectations.
This package provides a server mock that can handle PSR-7 HTTP requests. It also
provides a stream wrapper that integrates the server into PHP's filesystem functions
like file_get_contents().
<?php use Jfalque\HttpMock\Server; $server = (new Server()) ->whenUri('http://foo') ->return($foo = new Response()) ->end() ->whenUri('http://bar') ->return($bar = new Response()) ->end() ; $response = $server->handle(new Request('http://foo')); // $foo $response = $server->handle(new Request('http://bar')); // $bar $response = $server->handle(new Request('http://baz')); // null
Installation
Run the following Composer command:
$ composer require --dev jfalque/http-mock
More information
Read the documentation for more information.
统计信息
- 总下载量: 70.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-21