public function testPostActionWithNestedCollectionAndId0()
{
$request = $this->makeRequest('POST', '/person', json_encode(array('id' => 0, 'name' => 'Stan Lemon', 'cars' => array(array('id' => 0, 'name' => 'Honda', 'year' => 2006)))));
/** @var \Symfony\Component\HttpFoundation\Response $response */
$response = $this->controller->postAction($request, 'person');
$data = json_decode($response->getContent());
$this->assertEquals($data->name, "Stan Lemon");
$this->em->clear();
$refresh = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findOneBy(array('id' => $data->id));
$this->assertNotNull($refresh);
$this->assertNotEquals(0, $refresh->id);
$this->assertEquals("Stan Lemon", $refresh->name);
$this->assertCount(1, $refresh->cars);
$this->assertNotEquals(0, $refresh->cars[0]->id);
$this->assertEquals("Honda", $refresh->cars[0]->name);
$this->assertEquals(2006, $refresh->cars[0]->year);
$this->assertCount(1, $refresh->cars);
}