public function testLoadReference()
 {
     // pre conditions
     $object = new ReferenceMappingObject();
     $object->entityName = 'Name on document';
     $object->uuid = 'test-uuid';
     $testReferencedObject = new ProductDocument();
     $object->referencedField = $testReferencedObject;
     $testReferencedObject->uuid = 'test-uuid';
     $testReferencedObject->docName = 'Name on document';
     $referenceMapping = array('referencedField' => array('inversed-by' => 'uuid', 'referenced-by' => 'uuid', 'target-object' => get_class($testReferencedObject), 'fieldName' => 'referencedField', 'sync-type' => 'from-reference'));
     $this->classMetadata->expects($this->any())->method('getReferencedObjects')->will($this->returnValue($referenceMapping));
     $this->objectAdapterManager->expects($this->any())->method('getManager')->with($this->equalTo($object), $this->equalTo('referencedField'))->will($this->returnValue($this->documentManager));
     $this->documentManager->expects($this->once())->method('getReference')->with($this->equalTo(get_class($testReferencedObject)), $this->equalTo('test-uuid'))->will($this->returnValue($testReferencedObject));
     $this->UoW->loadReferences($object);
     $this->assertEquals($testReferencedObject, $object->referencedField);
     // the referenced object needs to be mapped, but not scheduled for remove/update/insert
     $this->assertCount(1, $this->UoW->getReferencedObjects());
     $this->assertCount(0, $this->UoW->getAllScheduledReferences());
 }