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/RealisticAdminController.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/RealisticAdminController.php')
| -rw-r--r-- | tests/Fixtures/RealisticAdminController.php | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/Fixtures/RealisticAdminController.php b/tests/Fixtures/RealisticAdminController.php new file mode 100644 index 0000000..e49fcd2 --- /dev/null +++ b/tests/Fixtures/RealisticAdminController.php @@ -0,0 +1,98 @@ +<?php + +declare(strict_types=1); + +namespace BrettParson\MiniRoute\Tests\Fixtures; + +use BrettParson\MiniRoute\Attribute\Get; +use BrettParson\MiniRoute\Attribute\Post; +use BrettParson\MiniRoute\Http\RequestInterface; +use BrettParson\MiniRoute\Http\ResponseInterface; + +/** + * Admin half of the brett-parson.com route model (13 routes). + * + * Includes the ordering nightmare case: POST /admin/entries/preview is a + * literal that must beat POST /admin/entries/{id}, independent of + * registration order. + */ +final class RealisticAdminController +{ + #[Get('/admin')] + public function dashboard(): ResponseInterface + { + return new TestResponse(200, 'admin-dashboard'); + } + + #[Get('/admin/notes')] + public function notesIndex(): ResponseInterface + { + return new TestResponse(200, 'notes-index'); + } + + #[Get('/admin/notes/new')] + public function notesNew(): ResponseInterface + { + return new TestResponse(200, 'notes-new'); + } + + #[Get('/admin/notes/{id}/edit')] + public function notesEdit(RequestInterface $request): ResponseInterface + { + return new TestResponse(200, 'notes-edit:' . $request->param('id')); + } + + #[Post('/admin/notes')] + public function notesStore(): ResponseInterface + { + return new TestResponse(200, 'notes-store'); + } + + #[Post('/admin/notes/{id}')] + public function notesUpdate(RequestInterface $request): ResponseInterface + { + return new TestResponse(200, 'notes-update:' . $request->param('id')); + } + + #[Post('/admin/notes/{id}/delete')] + public function notesDelete(): ResponseInterface + { + return new TestResponse(200, 'notes-delete'); + } + + #[Post('/admin/notes/{id}/restore')] + public function notesRestore(): ResponseInterface + { + return new TestResponse(200, 'notes-restore'); + } + + #[Get('/admin/entries/new')] + public function entriesNew(): ResponseInterface + { + return new TestResponse(200, 'entries-new'); + } + + #[Post('/admin/entries')] + public function entriesStore(): ResponseInterface + { + return new TestResponse(200, 'entries-store'); + } + + #[Post('/admin/entries/preview')] + public function entriesPreview(): ResponseInterface + { + return new TestResponse(200, 'entries-preview-literal'); + } + + #[Get('/admin/entries/{id}/edit')] + public function entriesEdit(RequestInterface $request): ResponseInterface + { + return new TestResponse(200, 'entries-edit:' . $request->param('id')); + } + + #[Post('/admin/entries/{id}')] + public function entriesUpdate(): ResponseInterface + { + return new TestResponse(200, 'entries-update'); + } +} |
