public function testScheduleInsert_ForUuidGenerator_QueriesUuidGenerator()
{
$uuids = array("4db492fb9e96682601d3f62b0797a8c0", "c3cee9c45f2fc2a3803ed26fdbceb3b4", "691f868266b6b45a867bfcb4b41a694e", "e2c4783e9ff922eefe869998a01828b2");
$uuidResponse = new \Doctrine\CouchDB\HTTP\Response(200, array(), json_encode(array('uuids' => $uuids)));
$client = $this->getMock('Doctrine\\CouchDB\\HTTP\\Client');
$client->expects($this->once())->method('request')->with($this->equalTo('GET'), $this->equalTo('/_uuids?count=20'))->will($this->returnValue($uuidResponse));
$this->dm->getCouchDBClient()->setHttpClient($client);
$object = new UoWUser();
$object->username = "bar";
$this->dm->getClassMetadata(get_class($object))->idGenerator = ClassMetadata::IDGENERATOR_UUID;
$this->uow->scheduleInsert($object);
$this->assertNotNull($object->id);
$this->assertEquals(end($uuids), $object->id);
}