@@ 29-38 (lines=10) @@ | ||
26 | $this->assertEquals('Invoice 2', $content[0]['name']); |
|
27 | } |
|
28 | ||
29 | public function testGetsActionWithSortDESC() { |
|
30 | $sort = json_encode(array( |
|
31 | array('property'=>'totalPrice', 'direction'=>'DESC') |
|
32 | )); |
|
33 | $this->client->request('GET', '/orders.json?sort='.$sort); |
|
34 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode()); |
|
35 | $content = json_decode($this->client->getResponse()->getContent(), true); |
|
36 | $this->assertEquals('Invoice 2', $content[0]['name']); |
|
37 | $this->assertEquals('Invoice 1', $content[1]['name']); |
|
38 | } |
|
39 | ||
40 | public function testGetsActionWithStart() { |
|
41 | $this->client->request('GET', '/orders.json?start=1'); |
@@ 45-54 (lines=10) @@ | ||
42 | $manager->createQueryBuilder()->delete('Test\TestBundle\Entity\CarOwner', 'co')->getQuery()->execute(); |
|
43 | } |
|
44 | ||
45 | public function testGetWithAssociation() { |
|
46 | $filter = json_encode(array( |
|
47 | array('property'=>'name','value'=>'Ford') |
|
48 | )); |
|
49 | $this->client->request('GET', '/cars.json?filter='.$filter); |
|
50 | $content = json_decode($this->client->getResponse()->getContent(), true); |
|
51 | $this->assertArrayHasKey('carOwner', $content[0]); |
|
52 | $this->assertInternalType('array', $content[0]['carOwner']); |
|
53 | $this->assertEquals($this->owner->getId(), $content[0]['carOwner']['id']); |
|
54 | } |
|
55 | ||
56 | public function testPostWithAssociation() { |
|
57 | $this->client->request('POST', '/cars.json', array(), array(), array(), json_encode(array( |
@@ 46-55 (lines=10) @@ | ||
43 | $this->assertEquals(0, count($content)); |
|
44 | } |
|
45 | ||
46 | public function testGetsActionWithSortASC() { |
|
47 | $sort = json_encode(array( |
|
48 | array('property'=>'name', 'direction'=>'ASC') |
|
49 | )); |
|
50 | $this->client->request('GET', '/cars.json?sort='.$sort); |
|
51 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode()); |
|
52 | $content = json_decode($this->client->getResponse()->getContent(), true); |
|
53 | $this->assertEquals('Ford', $content[0]['name']); |
|
54 | $this->assertEquals('Honda', $content[1]['name']); |
|
55 | } |
|
56 | ||
57 | public function testGetsActionWithSortDESC() { |
|
58 | $sort = json_encode(array( |