summaryrefslogtreecommitdiff
path: root/tests/Utils/TestMiddleware.php
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
committerSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
commitb899a995e2fd977fbf7497b36b2dbc8d641ef398 (patch)
treee35680ea490fb486da43012bbfaaee8b7ee27f8c /tests/Utils/TestMiddleware.php
parent57e101668e62aab7d332c1c2f403eee9511de626 (diff)
Started structure for middleware
Diffstat (limited to 'tests/Utils/TestMiddleware.php')
-rw-r--r--tests/Utils/TestMiddleware.php27
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);
+ }
+}