/** * @test */ public function knowAliasHasAValidNamespace() { $config1 = $this->getMock('Doctrine\\ODM\\MongoDB\\Configuration', array(), array(), '', false); $config1->expects($this->once())->method('getDocumentNamespaces')->will($this->returnValue(array('AcmeDemoBundle' => 'Acme\\DemoBundle\\Document'))); $config2 = $this->getMock('Doctrine\\ODM\\MongoDB\\Configuration', array(), array(), '', false); $config2->expects($this->once())->method('getDocumentNamespaces')->will($this->returnValue(array('AcmeBlogBundle' => 'Acme\\BlogBundle\\Document'))); $knownAliases = new KnownNamespaceAliases(); $knownAliases->addDocumentNamespaces($config1); $knownAliases->addDocumentNamespaces($config2); $this->assertEquals('Acme\\DemoBundle\\Document', $knownAliases->getFullyQualifiedNamespace('AcmeDemoBundle')); }
/** * @return MetaInformationFactory */ private function setupMetaInformationFactory() { $ormConfiguration = new Configuration(); $ormConfiguration->addEntityNamespace('FSTest:ValidTestEntity', 'FS\\SolrBundle\\Tests\\Doctrine\\Mapper'); $ormConfiguration->addEntityNamespace('FSTest:EntityCore0', 'FS\\SolrBundle\\Tests\\Doctrine\\Mapper'); $ormConfiguration->addEntityNamespace('FSTest:EntityCore1', 'FS\\SolrBundle\\Tests\\Doctrine\\Mapper'); $knowNamespaces = new KnownNamespaceAliases(); $knowNamespaces->addEntityNamespaces($ormConfiguration); $classnameResolver = new ClassnameResolver($knowNamespaces); $reader = new AnnotationReader(new \Doctrine\Common\Annotations\AnnotationReader()); $metaFactory = new MetaInformationFactory($reader); $metaFactory->setClassnameResolver($classnameResolver); return $metaFactory; }