protected function setUp() { // Register the DREST annotations \Drest\Mapping\Driver\AnnotationDriver::registerAnnotations(); // Register the ORM annotations \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(__DIR__ . '/../../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); }
protected function setUp() { \Drest\Mapping\Driver\AnnotationDriver::registerAnnotations(); }
public function testClassMetadataElementName() { $metadataFactory = new MetadataFactory(\Drest\Mapping\Driver\AnnotationDriver::create(array(__DIR__ . '/../Entities/Typical'))); $className = 'DrestTests\\Entities\\Typical\\User'; $cmd = $metadataFactory->getMetadataForClass($className); $this->assertEquals('user', $cmd->getElementName()); }
/** * Static call to create the Drest Manager instance * * @param EntityManager $em * @param Configuration $config * @param Event\Manager $eventManager * @return Manager $manager */ public static function create(EntityManager $em, Configuration $config, Event\Manager $eventManager = null) { // Register the annotations classes Mapping\Driver\AnnotationDriver::registerAnnotations(); if ($eventManager === null) { $eventManager = new Event\Manager(); } return new self($em, $config, $eventManager); }
public function testRemovingExtension() { $annotationDriver = \Drest\Mapping\Driver\AnnotationDriver::create(array(__DIR__ . '/../Entities/Typical')); $annotationDriver->removeExtensions(); $metadataFactory = new MetadataFactory($annotationDriver); $this->assertCount(0, $metadataFactory->getAllClassNames()); $annotationDriver->addExtension('php'); $this->assertGreaterThan(0, $metadataFactory->getAllClassNames()); }