Skip to content

Commit 0c8eb56

Browse files
authored
Create TestMiddleware.php
1 parent cad1471 commit 0c8eb56

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/TestMiddleware.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bermuda\Http\Middleware\Tests;
6+
7+
use Psr\Http\Message\ResponseInterface;
8+
use Psr\Http\Message\ServerRequestInterface;
9+
use Psr\Http\Server\MiddlewareInterface;
10+
use Psr\Http\Server\RequestHandlerInterface;
11+
12+
/**
13+
* Test middleware class used for verifying class-based middleware detection.
14+
*
15+
* This class is used in tests to verify that the Pipeline::has() method
16+
* can correctly identify middleware by their fully-qualified class name.
17+
* It implements pass-through behavior, delegating all requests to the next handler.
18+
*/
19+
final class TestMiddleware implements MiddlewareInterface
20+
{
21+
/**
22+
* Processes an incoming server request and returns a response.
23+
*
24+
* This is a pass-through implementation that immediately delegates
25+
* to the next handler in the chain without any modifications.
26+
*
27+
* @param ServerRequestInterface $request The incoming server request.
28+
* @param RequestHandlerInterface $handler The next handler in the chain.
29+
* @return ResponseInterface The response from the next handler.
30+
*/
31+
public function process(
32+
ServerRequestInterface $request,
33+
RequestHandlerInterface $handler
34+
): ResponseInterface {
35+
return $handler->handle($request);
36+
}
37+
}

0 commit comments

Comments
 (0)