vmpublishing/psr15-middleware-test-helpers
Composer 安装命令:
composer require vmpublishing/psr15-middleware-test-helpers
包简介
couple of often reused mocks for testing psr-15 middlewares
README 文档
README
WHAT
a collection of reusable mocks for phpunit for the common middleware-related interfaces
INSTALL
To install simply use
composer require vmpublishing/psr15-middleware-test-helpers
USE
As these are traits, just use them inside your testcase:
class SomeTest extends TestCase
{
use VM\Psr15Mocks\Middleware; // include to use
// this will generate the member variables:
// $request
// $response
// $requestHandler
// $body
// ..
// create them all properly
public function setUp(): void
{
$this->buildResponse();
$this->buildRequest();
$this->buildRequestHandler();
$this->buildBody();
}
// destroy them all properly
public function tearDown(): void
{
$this->destroyBody();
$this->destroyRequestHandler();
$this->destroyRequest();
$this->destroyResponse();
}
// ..
public function testSomething(): void
{
// use to validate calls
$this->response->expects($this->once())->method('getBody')->willReturn($this->body);
}
}
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-15