easy-http/mock-builder
最新稳定版本:v1.3.0
Composer 安装命令:
composer require easy-http/mock-builder
包简介
A fluid interface to build HTTP mocks with an expressive syntax
README 文档
README
🚀 Mock HTTP services
Mock builder
A fluid interface to build HTTP mocks with an expressive syntax. You can use this library to build mocks for Guzzle, Symfony and other HTTP Clients.
This library supports the following versions of Guzzle Http Client.
🔧 Installation
Use following command to install this library:
composer require easy-http/mock-builder
💡 Usage
Creating a simple Mock for Guzzle
use EasyHttp\MockBuilder\HttpMock; use EasyHttp\MockBuilder\MockBuilder; use GuzzleHttp\HandlerStack; use GuzzleHttp\Client; $builder = new MockBuilder(); $builder ->when() ->pathIs('/v1/products') ->methodIs('POST') ->then() ->body('bar'); $mock = new HttpMock($builder); $client = new Client(['handler' => HandlerStack::create($mock)]); $client ->post('/v1/products') ->getBody() ->getContents(); // bar
📚 Check out the Documentation to learn how to use this library.
统计信息
- 总下载量: 35.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-06