public function setUp()
{
if (!class_exists('Jackalope\\Factory', true)) {
$this->markTestSkipped('The Node needs to be properly mocked/stubbed. Remove dependency to Jackalope');
}
$this->factory = new Factory();
$this->session = $this->getMock('Jackalope\\Session', array(), array($this->factory), '', false);
$this->objectManager = $this->getMock('Jackalope\\ObjectManager', array(), array($this->factory), '', false);
$this->type = 'Doctrine\\Tests\\ODM\\PHPCR\\UoWUser';
$this->dm = DocumentManager::create($this->session);
$this->uow = new UnitOfWork($this->dm);
$cmf = $this->dm->getMetadataFactory();
$metadata = new ClassMetadata($this->type);
$metadata->initializeReflection($cmf->getReflectionService());
$metadata->mapId(array('fieldName' => 'id', 'id' => true));
$metadata->idGenerator = ClassMetadata::GENERATOR_TYPE_ASSIGNED;
$metadata->mapField(array('fieldName' => 'username', 'type' => 'string'));
$cmf->setMetadataFor($this->type, $metadata);
}