public function testResolveTargetDocumentListenerCanResolveTargetDocument()
 {
     $evm = $this->dm->getEventManager();
     $this->listener->addResolveTargetDocument('Doctrine\\ODM\\MongoDB\\Tests\\Tools\\ResolveTargetInterface', 'Doctrine\\ODM\\MongoDB\\Tests\\Tools\\ResolveTargetDocument', array());
     $this->listener->addResolveTargetDocument('Doctrine\\ODM\\MongoDB\\Tests\\Tools\\TargetInterface', 'Doctrine\\ODM\\MongoDB\\Tests\\Tools\\TargetDocument', array());
     $evm->addEventListener(Events::loadClassMetadata, $this->listener);
     $cm = $this->dm->getClassMetadata('Doctrine\\ODM\\MongoDB\\Tests\\Tools\\ResolveTargetDocument');
     $meta = $cm->associationMappings;
     $this->assertSame('Doctrine\\ODM\\MongoDB\\Tests\\Tools\\ResolveTargetDocument', $meta['refOne']['targetDocument']);
     $this->assertSame('Doctrine\\ODM\\MongoDB\\Tests\\Tools\\TargetDocument', $meta['refMany']['targetDocument']);
     $this->assertSame('Doctrine\\ODM\\MongoDB\\Tests\\Tools\\ResolveTargetDocument', $meta['embedOne']['targetDocument']);
     $this->assertSame('Doctrine\\ODM\\MongoDB\\Tests\\Tools\\TargetDocument', $meta['embedMany']['targetDocument']);
 }
 /**
  * {@inheritdoc}
  */
 public function addResolveTargetDocument($originalDocument, $newDocument, array $mapping)
 {
     $mapping['targetDocument'] = ltrim($newDocument, '\\\\');
     $this->resolveTargetEntities[ltrim($originalDocument, '\\\\')] = $mapping;
     parent::addResolveTargetDocument($originalDocument, $newDocument, $mapping);
 }