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
commit3604c8e0b9bb64d54cb639a001161ca0ede044e6 (patch)
tree4f10a58fe79b9cd539c5dae640531b9e260d8c54 /tests/Utils/TestMiddleware.php
parentd5803937abad436ee85be7478fa6f7cd0b3f3b21 (diff)
assert middleware call order
Diffstat (limited to 'tests/Utils/TestMiddleware.php')
-rw-r--r--tests/Utils/TestMiddleware.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/Utils/TestMiddleware.php b/tests/Utils/TestMiddleware.php
index 2f3ed32..0adb947 100644
--- a/tests/Utils/TestMiddleware.php
+++ b/tests/Utils/TestMiddleware.php
@@ -11,11 +11,21 @@ use Psr\Http\Message\ServerRequestInterface;
class TestMiddleware implements Middleware
{
+ private static int $staticCalls = 0;
+
+ private int $call;
private int $calls = 0;
+
+ public static function resetCalls(): void
+ {
+ self::$staticCalls = 0;
+ }
+
public function handle(ServerRequestInterface $request, callable $next): ResponseInterface
{
++$this->calls;
+ $this->call = ++self::$staticCalls;
return $next($request);
}
@@ -24,4 +34,9 @@ class TestMiddleware implements Middleware
{
Assert::assertGreaterThan(0, $this->calls);
}
+
+ public function assertCallNumber(int $num): void
+ {
+ Assert::assertSame($num, $this->call);
+ }
}