public function setUp() { $this->documentManager = $this->getMockBuilder('Doctrine\\ODM\\PHPCR\\DocumentManager')->disableOriginalConstructor()->getMock(); $this->objectManager = $this->getMock('Doctrine\\ORM\\EntityManagerInterface'); $this->eventManager = $this->getMockBuilder('Doctrine\\Common\\EventManager')->disableOriginalConstructor()->getMock(); $this->classMetadata = $this->getMockBuilder('Doctrine\\ORM\\ODMAdapter\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock(); $this->objectManager->expects($this->any())->method('getEventManager')->will($this->returnValue($this->eventManager)); $this->documentManager->expects($this->any())->method('getEventManager')->will($this->returnValue($this->eventManager)); $this->eventManager->expects($this->any())->method('addEventSubscriber'); $configuration = new Configuration(); $configuration->setManagers(array(Reference::DBAL_ORM => array('default' => $this->objectManager), Reference::PHPCR => array('default' => $this->documentManager))); $configuration->setClassMetadataFactoryName('Doctrine\\ORM\\ODMAdapter\\Mapping\\ClassMetadataFactory'); $this->objectAdapterManager = new ObjectAdapterManager($configuration); }
private function createObjectAdapterManager() { $configuration = new Configuration(); $configuration->setManagers(array('reference-phpcr' => array('default' => $this->dm), 'reference-dbal-orm' => array('default' => $this->em))); $configuration->setClassMetadataFactoryName('Doctrine\\ORM\\ODMAdapter\\Mapping\\ClassMetadataFactory'); $cache = new ArrayCache(); $reader = new AnnotationReader($cache); $annotationDriver = new AnnotationDriver($reader); $annotationDriver->addPaths(array(__DIR__ . "/../../../Models")); $configuration->setMetadataDriverImpl($annotationDriver); $configuration->setProxyDir(__DIR__ . '/cache'); $configuration->setAutoGenerateProxyClasses(true); $configuration->setProxyNamespace('__Test__'); $configuration->setClassMetadataFactoryName('Doctrine\\ORM\\ODMAdapter\\Mapping\\ClassMetadataFactory'); $this->objectAdapterManager = ObjectAdapterManager::create($configuration); $this->objectAdapterManager->addListenersToEventManagers(); }