public function getConnection() { // Retrieve PDO instance $pdo = $this->em->getConnection()->getWrappedConnection(); // Clear Doctrine to be safe $this->em->clear(); // Schema Tool to process our entities $tool = new \Doctrine\ORM\Tools\SchemaTool($this->em); $classes = $this->em->getMetaDataFactory()->getAllMetaData(); // Drop all classes and re-build them for each test case $tool->dropSchema($classes); $tool->createSchema($classes); // Pass to PHPUnit return $this->createDefaultDBConnection($pdo, 'db_name'); }
/** * @return ClassMetadata */ public function getEntityMetadata($entityName) { return $this->em->getMetaDataFactory()->getMetadataFor($this->getEntityName($entityName)); }