1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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');
}
}
|