public function setUp() { $annotationDriver = $this->createAnnotationDriver(); $this->em = $this->_getTestEntityManager(); $this->em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $this->factory = $this->em->getMetadataFactory(); $this->listener = new ResolveTargetEntityListener(); }
/** * setup EntityManager and tmp dir * * @return void */ public function setUp() { parent::setup(); $this->em = $this->sm->get($this->emAlias); if ($this->tmpDir && !is_dir($this->tmpDir)) { mkdir($this->tmpDir); } $metadatas = $this->em->getMetadataFactory()->getAllMetadata(); if (!empty($metadatas)) { $tool = new SchemaTool($this->em); $tool->createSchema($metadatas); } else { throw new SchemaException('No metadata classes to process'); } }
/** * Remove a database de testes * @return void */ public function dropDatabase() { $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->entityManager); $classes = $this->entityManager->getMetadataFactory()->getAllMetadata(); $schemaTool->dropSchema($classes); }