| @@ 64-74 (lines=11) @@ | ||
| 61 | $this->assertEquals(12, $order->getLineItems()->first()->getProductId()); |
|
| 62 | } |
|
| 63 | ||
| 64 | public function testPutWithNoAssocation() { |
|
| 65 | $record = $this->records[0]; |
|
| 66 | $this->client->request('PUT', '/orders/'.$record->getId().'.json', array(), array(), array(), json_encode(array( |
|
| 67 | 'name'=>'Invoice 1' |
|
| 68 | ))); |
|
| 69 | $repo = $this->client->getContainer()->get('doctrine_mongodb.odm.document_manager')->getRepository('TestTestBundle:Order'); |
|
| 70 | $record = json_decode($this->client->getResponse()->getContent(), true); |
|
| 71 | /** @var Order $order */ |
|
| 72 | $order = $repo->find($record['id']); |
|
| 73 | $this->assertEquals(0, $order->getLineItems()->count()); |
|
| 74 | } |
|
| 75 | ||
| 76 | public function testPatchWithDifferentAssociation() { |
|
| 77 | $this->client->request('PATCH', '/orders/'.$this->records[0]->getId().'.json', array(), array(), array(), json_encode(array( |
|
| @@ 56-66 (lines=11) @@ | ||
| 53 | ||
| 54 | } |
|
| 55 | ||
| 56 | public function testPutWithNoAssocation() { |
|
| 57 | $record = $this->records[0]; |
|
| 58 | $this->client->request('PUT', '/orders/'.$record->getId().'.json', array(), array(), array(), json_encode(array( |
|
| 59 | 'name'=>'Invoice 1' |
|
| 60 | ))); |
|
| 61 | $repo = $this->client->getContainer()->get('doctrine_mongodb.odm.document_manager')->getRepository('TestTestBundle:Order'); |
|
| 62 | $record = json_decode($this->client->getResponse()->getContent(), true); |
|
| 63 | /** @var Order $order */ |
|
| 64 | $order = $repo->find($record['id']); |
|
| 65 | $this->assertNull($order->getClient()); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function testPatchWithDifferentAssociation() { |
|
| 69 | $this->client->request('PATCH', '/orders/'.$this->records[0]->getId().'.json', array(), array(), array(), json_encode(array( |
|
| @@ 116-127 (lines=12) @@ | ||
| 113 | $this->assertEquals($this->owner, $car->getCarOwner()); |
|
| 114 | } |
|
| 115 | ||
| 116 | public function testPutWithNoAssocation() { |
|
| 117 | $record = $this->records[0]; |
|
| 118 | $this->client->request('PUT', '/cars/'.$record->getId().'.json', array(), array(), array(), json_encode(array( |
|
| 119 | 'name'=>'Mazda', |
|
| 120 | 'plateNumber'=>'AA00' |
|
| 121 | ))); |
|
| 122 | $repo = $this->client->getContainer()->get('doctrine.orm.default_entity_manager')->getRepository('TestTestBundle:Car'); |
|
| 123 | $record = json_decode($this->client->getResponse()->getContent(), true); |
|
| 124 | /** @var Car $car */ |
|
| 125 | $car = $repo->find($record['id']); |
|
| 126 | $this->assertNull($car->getCarOwner()); |
|
| 127 | } |
|
| 128 | ||
| 129 | public function testPutWithDifferentAssociation() { |
|
| 130 | $record = $this->records[0]; |
|