diff options
| author | Brett Parson <brett@brett-parson.com> | 2026-08-29 15:56:31 -0500 |
|---|---|---|
| committer | Brett Parson <brett@brett-parson.com> | 2026-08-29 15:56:31 -0500 |
| commit | 965551532d684456b74baf960157c0c2cef7335d (patch) | |
| tree | 1445afbc47730caa11d08fd84d9d65db132821f5 /tests/Fixtures/StatefulMiddleware.php | |
| parent | d039a5d62a9ac6ababae70d9d96422ca59f2b2d4 (diff) | |
| download | miniroute-965551532d684456b74baf960157c0c2cef7335d.tar.gz miniroute-965551532d684456b74baf960157c0c2cef7335d.zip | |
Add regression and integration test suite
Port the stress-test findings into PHPUnit: realistic brett-parson.com
route model, known-issue baselines, router boundary cases, and a
standalone scaling benchmark (composer bench).
Diffstat (limited to 'tests/Fixtures/StatefulMiddleware.php')
| -rw-r--r-- | tests/Fixtures/StatefulMiddleware.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Fixtures/StatefulMiddleware.php b/tests/Fixtures/StatefulMiddleware.php new file mode 100644 index 0000000..d374238 --- /dev/null +++ b/tests/Fixtures/StatefulMiddleware.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +namespace BrettParson\MiniRoute\Tests\Fixtures; + +use BrettParson\MiniRoute\Http\RequestInterface; +use BrettParson\MiniRoute\Http\ResponseInterface; +use BrettParson\MiniRoute\Middleware\MiddlewareInterface; + +/** + * Deliberately stateful middleware. Probes the singleton-container leak: + * when a resolver returns the same instance per request, state accumulates + * across dispatches (usage contract; ADR work in miniroute-k4i.3). + */ +final class StatefulMiddleware implements MiddlewareInterface +{ + public int $count = 0; + + public function handle(RequestInterface $request, callable $next): ResponseInterface + { + $this->count++; + + return $next($request); + } +} |
