@@ 116-129 (lines=14) @@ | ||
113 | $this->assertEquals(12.11, $record->getTotalPrice()); |
|
114 | } |
|
115 | ||
116 | public function testPutActionWithSomeEmpty() { |
|
117 | $record = $this->records[0]; |
|
118 | $this->client->request('PUT', '/orders/'.$record->getId().'.json', array(), array(), array(), json_encode(array( |
|
119 | 'name'=>'Invoice B', |
|
120 | ))); |
|
121 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode()); |
|
122 | $repo = $this->client->getContainer()->get('doctrine_mongodb.odm.default_document_manager')->getRepository('TestTestBundle:Order'); |
|
123 | $this->assertEquals( |
|
124 | 2, count($repo->findAll()) |
|
125 | ); |
|
126 | $record = $repo->find($record->getId()); |
|
127 | $this->assertEquals('Invoice B', $record->getName()); |
|
128 | $this->assertEquals(null, $record->getTotalPrice()); |
|
129 | } |
|
130 | ||
131 | public function testPatchAction() { |
|
132 | $originalRecord = $this->records[0]; |
|
@@ 131-144 (lines=14) @@ | ||
128 | $this->assertEquals(null, $record->getTotalPrice()); |
|
129 | } |
|
130 | ||
131 | public function testPatchAction() { |
|
132 | $originalRecord = $this->records[0]; |
|
133 | $this->client->request('PATCH', '/orders/'.$originalRecord->getId().'.json', array(), array(), array(), json_encode(array( |
|
134 | 'name'=>'Invoice A', |
|
135 | ))); |
|
136 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode()); |
|
137 | $repo = $this->client->getContainer()->get('doctrine_mongodb.odm.default_document_manager')->getRepository('TestTestBundle:Order'); |
|
138 | $record = $repo->find($originalRecord->getId()); |
|
139 | $this->assertEquals( |
|
140 | 2, count($repo->findAll()) |
|
141 | ); |
|
142 | $this->assertEquals('Invoice A', $record->getName()); |
|
143 | $this->assertEquals($originalRecord->getTotalPrice(), $record->getTotalPrice()); |
|
144 | } |
|
145 | ||
146 | public function testDeleteAction() { |
|
147 | $record = $this->records[0]; |
@@ 158-171 (lines=14) @@ | ||
155 | $this->assertEquals('AA00', $record->getPlateNumber()); |
|
156 | } |
|
157 | ||
158 | public function testPutActionWithSomeEmpty() { |
|
159 | $record = $this->records[0]; |
|
160 | $this->client->request('PUT', '/cars/'.$record->getId().'.json', array(), array(), array(), json_encode(array( |
|
161 | 'name'=>'Mazda', |
|
162 | ))); |
|
163 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode()); |
|
164 | $repo = $this->client->getContainer()->get('doctrine.orm.default_entity_manager')->getRepository('TestTestBundle:Car'); |
|
165 | $this->assertEquals( |
|
166 | 3, count($repo->findAll()) |
|
167 | ); |
|
168 | $record = $repo->find($record->getId()); |
|
169 | $this->assertEquals('Mazda', $record->getName()); |
|
170 | $this->assertEquals(null, $record->getPlateNumber()); |
|
171 | } |
|
172 | ||
173 | public function testPatchAction() { |
|
174 | $originalRecord = $this->records[0]; |
|
@@ 173-186 (lines=14) @@ | ||
170 | $this->assertEquals(null, $record->getPlateNumber()); |
|
171 | } |
|
172 | ||
173 | public function testPatchAction() { |
|
174 | $originalRecord = $this->records[0]; |
|
175 | $this->client->request('PATCH', '/cars/'.$originalRecord->getId().'.json', array(), array(), array(), json_encode(array( |
|
176 | 'name'=>'Mazda', |
|
177 | ))); |
|
178 | $this->assertEquals("200", $this->client->getResponse()->getStatusCode()); |
|
179 | $repo = $this->client->getContainer()->get('doctrine.orm.default_entity_manager')->getRepository('TestTestBundle:Car'); |
|
180 | $record = $repo->find($originalRecord->getId()); |
|
181 | $this->assertEquals( |
|
182 | 3, count($repo->findAll()) |
|
183 | ); |
|
184 | $this->assertEquals('Mazda', $record->getName()); |
|
185 | $this->assertEquals($originalRecord->getPlateNumber(), $record->getPlateNumber()); |
|
186 | } |
|
187 | ||
188 | public function testDeleteAction() { |
|
189 | $record = $this->records[0]; |