@@ 149-169 (lines=21) @@ | ||
146 | * @group put |
|
147 | * @group controller |
|
148 | */ |
|
149 | public function testPutSansResultat() |
|
150 | { |
|
151 | $this->loadFixtureFiles( |
|
152 | [ |
|
153 | '@StarkerxpUserBundle/Tests/DataFixtures/UserManager/DefaultUser.yml', |
|
154 | ||
155 | ] |
|
156 | ); |
|
157 | $data = [ |
|
158 | //'nom' => "Mon nom", //exemple |
|
159 | ]; |
|
160 | $url = $this->generateUrl( |
|
161 | 'starkerxp_lead.lead.put', |
|
162 | [ |
|
163 | "lead_id" => 404, |
|
164 | ] |
|
165 | ); |
|
166 | $client = $this->getAuthClient(); |
|
167 | $client->request('PUT', $url, $data); |
|
168 | $response = $client->getResponse(); |
|
169 | $this->assertEquals(404, $response->getStatusCode()); |
|
170 | $body = json_decode($response->getContent(), true); |
|
171 | $this->assertNotEmpty($body); |
|
172 | } |
|
@@ 180-201 (lines=22) @@ | ||
177 | * @group cget |
|
178 | * @group controller |
|
179 | */ |
|
180 | public function testCGetValideAvecResultats() |
|
181 | { |
|
182 | $this->loadFixtureFiles( |
|
183 | [ |
|
184 | '@StarkerxpUserBundle/Tests/DataFixtures/UserManager/DefaultUser.yml', |
|
185 | ||
186 | '@StarkerxpLeadBundle/Tests/DataFixtures/LeadManager/LeadManager.yml', |
|
187 | ] |
|
188 | ); |
|
189 | $url = $this->generateUrl( |
|
190 | 'starkerxp_lead.lead.cget', |
|
191 | [ |
|
192 | ||
193 | ] |
|
194 | ); |
|
195 | $client = $this->getAuthClient(); |
|
196 | $client->request('GET', $url, []); |
|
197 | $response = $client->getResponse(); |
|
198 | $this->assertEquals(200, $response->getStatusCode()); |
|
199 | $body = json_decode($response->getContent(), true); |
|
200 | $this->assertCount(10, $body); |
|
201 | foreach ($body as $element) { |
|
202 | //$this->assertArrayHasKey("nom", $body); // Exemple |
|
203 | } |
|
204 | } |
|
@@ 211-228 (lines=18) @@ | ||
208 | * @group cget |
|
209 | * @group controller |
|
210 | */ |
|
211 | public function testCGetValideSansResultat() |
|
212 | { |
|
213 | $this->loadFixtureFiles( |
|
214 | [ |
|
215 | '@StarkerxpUserBundle/Tests/DataFixtures/UserManager/DefaultUser.yml', |
|
216 | ||
217 | ] |
|
218 | ); |
|
219 | $url = $this->generateUrl( |
|
220 | 'starkerxp_lead.lead.cget', |
|
221 | [ |
|
222 | ||
223 | ] |
|
224 | ); |
|
225 | $client = $this->getAuthClient(); |
|
226 | $client->request('GET', $url, []); |
|
227 | $response = $client->getResponse(); |
|
228 | $this->assertEquals(200, $response->getStatusCode()); |
|
229 | $body = json_decode($response->getContent(), true); |
|
230 | $this->assertCount(0, $body); |
|
231 | } |
|
@@ 296-313 (lines=18) @@ | ||
293 | * @group get |
|
294 | * @group controller |
|
295 | */ |
|
296 | public function testGetValideSansResultat() |
|
297 | { |
|
298 | $this->loadFixtureFiles( |
|
299 | [ |
|
300 | '@StarkerxpUserBundle/Tests/DataFixtures/UserManager/DefaultUser.yml', |
|
301 | ||
302 | ] |
|
303 | ); |
|
304 | $url = $this->generateUrl( |
|
305 | 'starkerxp_lead.lead.get', |
|
306 | [ |
|
307 | "lead_id" => 404, |
|
308 | ] |
|
309 | ); |
|
310 | $client = $this->getAuthClient(); |
|
311 | $client->request('GET', $url, []); |
|
312 | $response = $client->getResponse(); |
|
313 | $this->assertEquals(404, $response->getStatusCode()); |
|
314 | $body = json_decode($response->getContent(), true); |
|
315 | $this->assertNotEmpty($body); |
|
316 | } |