diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-11 23:46:28 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-19 13:59:39 +0200 |
commit | f3b3b6683ca90b70ec4d4daae002dc0caac9ebdd (patch) | |
tree | c550252995a46763d8c540c9bd7f41e4b1c4f246 /tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php | |
parent | f3f05f6cc4bef3338dbfb6eb340da4fb1c5ba1e1 (diff) |
Added middleware tests
Diffstat (limited to 'tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php')
-rw-r--r-- | tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php new file mode 100644 index 00000000..7c241353 --- /dev/null +++ b/tests/Unit/Middleware/Stub/ReturnResponseMiddleware.php @@ -0,0 +1,36 @@ +<?php + +namespace Engelsystem\Test\Unit\Middleware\Stub; + +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; +use Psr\Http\Server\MiddlewareInterface; +use Psr\Http\Server\RequestHandlerInterface; + +class ReturnResponseMiddleware implements MiddlewareInterface +{ + /** @var ResponseInterface */ + protected $response; + + public function __construct(ResponseInterface $response) + { + $this->response = $response; + } + + /** + * Process an incoming server request and return a response, optionally delegating + * response creation to a handler. + * + * Could be used to group middleware + * + * @param ServerRequestInterface $request + * @param RequestHandlerInterface $handler + * @return ResponseInterface + */ + public function process( + ServerRequestInterface $request, + RequestHandlerInterface $handler + ): ResponseInterface { + return $this->response; + } +} |