diff options
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); + } +} |
