public function testCanUseDecoratedRequestAndResponseDirectly()
{
$baseRequest = new Request([], [], 'http://local.example.com/foo', 'GET', 'php://memory');
$request = new RequestDecorator($baseRequest);
$response = new ResponseDecorator($this->response);
$phpunit = $this;
$executed = false;
$middleware = $this->middleware;
$middleware->pipe(function ($req, $res, $next) use($phpunit, $request, $response, &$executed) {
$phpunit->assertSame($request, $req);
$phpunit->assertSame($response, $res);
$executed = true;
});
$middleware($request, $response, function ($err = null) use($phpunit) {
$phpunit->fail('Next should not be called');
});
$this->assertTrue($executed);
}