1 | <?php |
||
25 | class TestApiController extends Controller |
||
26 | { |
||
27 | private $_em; |
||
28 | private $expectationManager; |
||
29 | |||
30 | 19 | public function setContainer(ContainerInterface $container = null) |
|
36 | |||
37 | /** |
||
38 | * Returns the details of the given test |
||
39 | * |
||
40 | * @Route("/{id}") |
||
41 | * @Method({"GET"}) |
||
42 | * @ApiDoc( |
||
43 | * resource=true, |
||
44 | * requirements={ |
||
45 | * {"name"="id", "description"="The ID of the test to return", "dataType"="integer", "requirement"="\d+"} |
||
46 | * }, |
||
47 | * tags={ |
||
48 | * "Super Admin" = "#ff1919", |
||
49 | * "Admin" = "#ffff33", |
||
50 | * "User" = "#75ff47" |
||
51 | * } |
||
52 | * ) |
||
53 | */ |
||
54 | 2 | public function getTestAction(Test $test) |
|
62 | |||
63 | /** |
||
64 | * Creates a test in the given group |
||
65 | * |
||
66 | * @Route("/group/{id}") |
||
67 | * @Method({"POST"}) |
||
68 | * @Security("is_granted('edit', group)") |
||
69 | * @ApiDoc( |
||
70 | * resource=true, |
||
71 | * parameters={ |
||
72 | * {"name"="name", "description"="A user-friendly name for the test", "required"=true, "format"="Github Status", "dataType"="string"}, |
||
73 | * {"name"="actual", "description"="The actual value to test against", "required"=true, "format"="status.github.com", "dataType"="string"}, |
||
74 | * {"name"="expectation", "description"="The expectation to test with", "required"=true, "format"="toResolveTo", "dataType"="string"}, |
||
75 | * {"name"="expected", "description"="The expected value to test against", "required"=false, "format"="octostatus-production.github.com", "dataType"="string"}, |
||
76 | * }, |
||
77 | * requirements={ |
||
78 | * {"name"="id", "description"="The ID of the group to create the test under", "dataType"="integer", "requirement"="\d+"} |
||
79 | * }, |
||
80 | * tags={ |
||
81 | * "Super Admin" = "#ff1919", |
||
82 | * "Admin" = "#ffff33" |
||
83 | * } |
||
84 | * ) |
||
85 | */ |
||
86 | 3 | public function createTestAction(Request $request, TestGroup $group) |
|
112 | |||
113 | /** |
||
114 | * Returns a list of tests in the given group |
||
115 | * |
||
116 | * @Route("/group/{id}") |
||
117 | * @Method({"GET"}) |
||
118 | * @Security("is_granted('view', group)") |
||
119 | * @ApiDoc( |
||
120 | * requirements={ |
||
121 | * {"name"="id", "description"="The ID of the group to return tests from", "dataType"="integer", "requirement"="\d+"} |
||
122 | * }, |
||
123 | * tags={ |
||
124 | * "Super Admin" = "#ff1919", |
||
125 | * "Admin" = "#ffff33", |
||
126 | * "User" = "#75ff47" |
||
127 | * } |
||
128 | * ) |
||
129 | */ |
||
130 | 1 | public function getTestsInGroupAction(TestGroup $group) |
|
134 | |||
135 | /** |
||
136 | * Updates the details of the given test |
||
137 | * |
||
138 | * @Route("/{id}") |
||
139 | * @Method({"PUT"}) |
||
140 | * @ApiDoc( |
||
141 | * parameters={ |
||
142 | * {"name"="name", "description"="A user-friendly name for the test", "required"=false, "format"="Github Status", "dataType"="string"}, |
||
143 | * {"name"="actual", "description"="The actual value to test against", "required"=false, "format"="status.github.com", "dataType"="string"}, |
||
144 | * {"name"="expectation", "description"="The expectation to test with", "required"=false, "format"="toResolveTo", "dataType"="string"}, |
||
145 | * {"name"="expected", "description"="The expected value to test against", "required"=false, "format"="octostatus-production.github.com", "dataType"="string"}, |
||
146 | * }, |
||
147 | * requirements={ |
||
148 | * {"name"="id", "description"="The ID of the test to edit the details of", "dataType"="integer", "requirement"="\d+"} |
||
149 | * }, |
||
150 | * tags={ |
||
151 | * "Super Admin" = "#ff1919", |
||
152 | * "Admin" = "#ffff33" |
||
153 | * } |
||
154 | * ) |
||
155 | */ |
||
156 | 2 | public function updateTestAction(Request $request, Test $test) |
|
171 | |||
172 | /** |
||
173 | * Deletes the given test |
||
174 | * |
||
175 | * @Route("/{id}") |
||
176 | * @Method({"DELETE"}) |
||
177 | * @ApiDoc( |
||
178 | * requirements={ |
||
179 | * {"name"="id", "description"="The ID of the test to delete", "dataType"="integer", "requirement"="\d+"} |
||
180 | * }, |
||
181 | * tags={ |
||
182 | * "Super Admin" = "#ff1919", |
||
183 | * "Admin" = "#ffff33" |
||
184 | * } |
||
185 | * ) |
||
186 | */ |
||
187 | 2 | public function deleteTestAction(Test $test) |
|
198 | |||
199 | /** |
||
200 | * Runs a test |
||
201 | * |
||
202 | * @Route("/{id}") |
||
203 | * @Method({"POST"}) |
||
204 | * @ApiDoc( |
||
205 | * requirements={ |
||
206 | * {"name"="id", "description"="The ID of the test to run", "dataType"="integer", "requirement"="\d+"} |
||
207 | * }, |
||
208 | * tags={ |
||
209 | * "Super Admin" = "#ff1919", |
||
210 | * "Admin" = "#ffff33" |
||
211 | * } |
||
212 | * ) |
||
213 | */ |
||
214 | 2 | public function runTestAction(Test $test) |
|
227 | } |
||
228 |