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