| @@ 100-114 (lines=15) @@ | ||
| 97 | $this->assertEquals("400", $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent()); |
|
| 98 | } |
|
| 99 | ||
| 100 | public function testPutAction() { |
|
| 101 | $record = $this->records[0]; |
|
| 102 | $this->client->request('PUT', '/orders/'.$record->getId().'.json', array(), array(), array(), json_encode(array( |
|
| 103 | 'name'=>'Invoice A', |
|
| 104 | 'totalPrice'=>12.11, |
|
| 105 | ))); |
|
| 106 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent()); |
|
| 107 | $repo = $this->client->getContainer()->get('doctrine_mongodb.odm.default_document_manager')->getRepository('TestTestBundle:Order'); |
|
| 108 | $this->assertEquals( |
|
| 109 | 2, count($repo->findAll()) |
|
| 110 | ); |
|
| 111 | $record = $repo->find($record->getId()); |
|
| 112 | $this->assertEquals('Invoice A', $record->getName()); |
|
| 113 | $this->assertEquals(12.11, $record->getTotalPrice()); |
|
| 114 | } |
|
| 115 | ||
| 116 | public function testPutActionWithSomeEmpty() { |
|
| 117 | $record = $this->records[0]; |
|
| @@ 142-156 (lines=15) @@ | ||
| 139 | $this->assertEquals("400", $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent()); |
|
| 140 | } |
|
| 141 | ||
| 142 | public function testPutAction() { |
|
| 143 | $record = $this->records[0]; |
|
| 144 | $this->client->request('PUT', '/cars/'.$record->getId().'.json', array(), array(), array(), json_encode(array( |
|
| 145 | 'name'=>'Mazda', |
|
| 146 | 'plateNumber'=>'AA00', |
|
| 147 | ))); |
|
| 148 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent()); |
|
| 149 | $repo = $this->client->getContainer()->get('doctrine.orm.default_entity_manager')->getRepository('TestTestBundle:Car'); |
|
| 150 | $this->assertEquals( |
|
| 151 | 3, count($repo->findAll()) |
|
| 152 | ); |
|
| 153 | $record = $repo->find($record->getId()); |
|
| 154 | $this->assertEquals('Mazda', $record->getName()); |
|
| 155 | $this->assertEquals('AA00', $record->getPlateNumber()); |
|
| 156 | } |
|
| 157 | ||
| 158 | public function testPutActionWithSomeEmpty() { |
|
| 159 | $record = $this->records[0]; |
|