public function testLoadMetadataForNonDocumentThrowsException() { $cm = new ClassMetadata('stdClass'); $cm->initializeReflection(new RuntimeReflectionService()); $reader = new \Doctrine\Common\Annotations\AnnotationReader(new \Doctrine\Common\Cache\ArrayCache()); $annotationDriver = new \Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver($reader); $this->setExpectedException('Doctrine\\ODM\\PHPCR\\Mapping\\MappingException'); $annotationDriver->loadMetadataForClass('stdClass', $cm); }
/** * @param $fqn * * @return ClassMetadata */ protected function getMetadataFor($fqn) { $cache = new \Doctrine\Common\Cache\ArrayCache(); $reader = new \Doctrine\Common\Annotations\AnnotationReader($cache); $annotationDriver = new \Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver($reader); $annotationDriver->addPaths(array(__DIR__ . '/Model')); $this->dm->getConfiguration()->setMetadataDriverImpl($annotationDriver); $cmf = new ClassMetadataFactory($this->dm); $meta = $cmf->getMetadataFor($fqn); return $meta; }