diff options
| author | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
|---|---|---|
| committer | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
| commit | b899a995e2fd977fbf7497b36b2dbc8d641ef398 (patch) | |
| tree | e35680ea490fb486da43012bbfaaee8b7ee27f8c /tests/Utils/TestMiddleware.php | |
| parent | 57e101668e62aab7d332c1c2f403eee9511de626 (diff) | |
Started structure for middleware
Diffstat (limited to 'tests/Utils/TestMiddleware.php')
| -rw-r--r-- | tests/Utils/TestMiddleware.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/Utils/TestMiddleware.php b/tests/Utils/TestMiddleware.php new file mode 100644 index 0000000..2f3ed32 --- /dev/null +++ b/tests/Utils/TestMiddleware.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +namespace Lightscale\Router\Test\Utils; + +use Lightscale\Router\Contracts\Middleware; +use PHPUnit\Framework\Assert; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; + +class TestMiddleware implements Middleware +{ + private int $calls = 0; + + public function handle(ServerRequestInterface $request, callable $next): ResponseInterface + { + ++$this->calls; + + return $next($request); + } + + public function assertCalled(): void + { + Assert::assertGreaterThan(0, $this->calls); + } +} |
