@@ 129-149 (lines=21) @@ | ||
126 | * @group put |
|
127 | * @group controller |
|
128 | */ |
|
129 | public function testPutSansResultat() |
|
130 | { |
|
131 | $this->loadFixtureFiles([ |
|
132 | '@StarkerxpUtilisateurBundle/Tests/DataFixtures/UtilisateurManager/DefaultUtilisateur.yml', |
|
133 | ]); |
|
134 | $data = [ |
|
135 | //'nom' => "Mon nom", //exemple |
|
136 | ]; |
|
137 | $url = $this->generateUrl( |
|
138 | 'starkerxp_lead.lead.put', |
|
139 | [ |
|
140 | "id" => 404, |
|
141 | ] |
|
142 | ); |
|
143 | $client = $this->getAuthClient(); |
|
144 | $client->request('PUT', $url, $data); |
|
145 | $response = $client->getResponse(); |
|
146 | $this->assertEquals(404, $response->getStatusCode()); |
|
147 | $body = json_decode($response->getContent(), true); |
|
148 | $this->assertNotEmpty($body); |
|
149 | } |
|
150 | ||
151 | ||
152 | /** |
|
@@ 157-178 (lines=22) @@ | ||
154 | * @group cget |
|
155 | * @group controller |
|
156 | */ |
|
157 | public function testCGetValideAvecResultats() |
|
158 | { |
|
159 | $this->loadFixtureFiles([ |
|
160 | '@StarkerxpUtilisateurBundle/Tests/DataFixtures/UtilisateurManager/DefaultUtilisateur.yml', |
|
161 | '@StarkerxpLeadBundle/Tests/DataFixtures/LeadActionManager/LeadManager.yml', |
|
162 | ]); |
|
163 | $url = $this->generateUrl( |
|
164 | 'starkerxp_lead.lead.cget', |
|
165 | [ |
|
166 | ||
167 | ] |
|
168 | ); |
|
169 | $client = $this->getAuthClient(); |
|
170 | $client->request('GET', $url, []); |
|
171 | $response = $client->getResponse(); |
|
172 | $this->assertEquals(200, $response->getStatusCode()); |
|
173 | $body = json_decode($response->getContent(), true); |
|
174 | $this->assertCount(10, $body); |
|
175 | foreach ($body as $element) { |
|
176 | //$this->assertArrayHasKey("nom", $body); // Exemple |
|
177 | } |
|
178 | } |
|
179 | ||
180 | /** |
|
181 | * @group lead |
|
@@ 185-202 (lines=18) @@ | ||
182 | * @group cget |
|
183 | * @group controller |
|
184 | */ |
|
185 | public function testCGetValideSansResultat() |
|
186 | { |
|
187 | $this->loadFixtureFiles([ |
|
188 | '@StarkerxpUtilisateurBundle/Tests/DataFixtures/UtilisateurManager/DefaultUtilisateur.yml', |
|
189 | ]); |
|
190 | $url = $this->generateUrl( |
|
191 | 'starkerxp_lead.lead.cget', |
|
192 | [ |
|
193 | ||
194 | ] |
|
195 | ); |
|
196 | $client = $this->getAuthClient(); |
|
197 | $client->request('GET', $url, []); |
|
198 | $response = $client->getResponse(); |
|
199 | $this->assertEquals(200, $response->getStatusCode()); |
|
200 | $body = json_decode($response->getContent(), true); |
|
201 | $this->assertCount(0, $body); |
|
202 | } |
|
203 | ||
204 | /** |
|
205 | * @group lead |
|
@@ 260-277 (lines=18) @@ | ||
257 | * @group get |
|
258 | * @group controller |
|
259 | */ |
|
260 | public function testGetValideSansResultat() |
|
261 | { |
|
262 | $this->loadFixtureFiles([ |
|
263 | '@StarkerxpUtilisateurBundle/Tests/DataFixtures/UtilisateurManager/DefaultUtilisateur.yml', |
|
264 | ]); |
|
265 | $url = $this->generateUrl( |
|
266 | 'starkerxp_lead.lead.get', |
|
267 | [ |
|
268 | "id" => 404, |
|
269 | ] |
|
270 | ); |
|
271 | $client = $this->getAuthClient(); |
|
272 | $client->request('GET', $url, []); |
|
273 | $response = $client->getResponse(); |
|
274 | $this->assertEquals(404, $response->getStatusCode()); |
|
275 | $body = json_decode($response->getContent(), true); |
|
276 | $this->assertNotEmpty($body); |
|
277 | } |
|
278 | ||
279 | /** |
|
280 | * @group lead |
|
@@ 335-352 (lines=18) @@ | ||
332 | * @group delete |
|
333 | * @group controller |
|
334 | */ |
|
335 | public function testDeleteSansResultat() |
|
336 | { |
|
337 | $this->loadFixtureFiles([ |
|
338 | '@StarkerxpUtilisateurBundle/Tests/DataFixtures/UtilisateurManager/DefaultUtilisateur.yml', |
|
339 | ]); |
|
340 | $url = $this->generateUrl( |
|
341 | 'starkerxp_lead.lead.get', |
|
342 | [ |
|
343 | "id" => 404, |
|
344 | ] |
|
345 | ); |
|
346 | $client = $this->getAuthClient(); |
|
347 | $client->request('DELETE', $url, []); |
|
348 | $response = $client->getResponse(); |
|
349 | $this->assertEquals(404, $response->getStatusCode()); |
|
350 | $body = json_decode($response->getContent(), true); |
|
351 | $this->assertNotEmpty($body); |
|
352 | } |
|
353 | } |
|
354 |