Conditions | 1 |
Paths | 1 |
Total Lines | 32 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function testCountAction($kernel) |
||
16 | { |
||
17 | self::createAndBootKernel($kernel); |
||
18 | self::configureDb(); |
||
19 | |||
20 | $em = self::getEntityManager(); |
||
21 | $entity = new MyEntity('my-test-secret'); |
||
22 | $em->persist($entity); |
||
23 | $parent = new MyEntity('non-recursing-entity'); |
||
24 | $em->persist($parent); |
||
25 | $entity->setParent($parent); |
||
26 | $em->flush(); |
||
27 | $em->clear(); |
||
28 | |||
29 | $client = self::createClient(); |
||
30 | $client->request( |
||
31 | 'GET', |
||
32 | '/api/entity/my-entity/count', |
||
33 | [ |
||
34 | 'criteria' => [], |
||
35 | ], |
||
36 | [], |
||
37 | ['HTTP_CONTENT_TYPE' => 'application/json'] |
||
38 | ); |
||
39 | $response = $client->getResponse(); |
||
40 | |||
41 | self::assertTrue($response->isSuccessful()); |
||
42 | $data = json_decode($response->getContent()); |
||
43 | |||
44 | self::assertEquals(JSON_ERROR_NONE, json_last_error()); |
||
45 | self::assertEquals(2, $data); |
||
46 | } |
||
47 | } |
||
48 |