/**
  * Creates a connection to the test database, if there is none yet, and
  * creates the necessary tables.
  */
 protected function setUp()
 {
     $forceCreateTables = false;
     if (!isset($this->sharedFixture['conn'])) {
         $this->sharedFixture['conn'] = TestUtil::getConnection();
         if ($this->sharedFixture['conn']->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
             $forceCreateTables = true;
         }
     }
     if (!$this->_em) {
         $this->_em = $this->_getEntityManager();
         $this->_schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
     }
     $classes = array();
     foreach ($this->_usedModelSets as $setName => $bool) {
         if (!isset(self::$_tablesCreated[$setName]) || $forceCreateTables) {
             foreach (self::$_modelSets[$setName] as $className) {
                 $classes[] = $this->_em->getClassMetadata($className);
             }
             self::$_tablesCreated[$setName] = true;
         }
     }
     if ($classes) {
         try {
             $this->_schemaTool->createSchema($classes);
         } catch (\Exception $e) {
             // Suppress "xxx already exists" messages
             if (stripos($e->getMessage(), 'already exists') === false) {
                 throw $e;
             }
         }
     }
 }
 protected function setUp()
 {
     if (!isset(self::$_sharedConn)) {
         self::$_sharedConn = TestUtil::getConnection();
     }
     $this->_conn = self::$_sharedConn;
 }
 protected function setUp()
 {
     if (!isset(self::$_sharedConn)) {
         self::$_sharedConn = TestUtil::getConnection();
     }
     $this->_conn = self::$_sharedConn;
     $this->_sqlLoggerStack = new \Doctrine\DBAL\Logging\DebugStack();
     $this->_conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack);
 }
 protected function setUp()
 {
     if (isset($this->sharedFixture['conn'])) {
         $this->_conn = $this->sharedFixture['conn'];
     } else {
         if (!isset(self::$_sharedConn)) {
             self::$_sharedConn = TestUtil::getConnection();
         }
         $this->_conn = self::$_sharedConn;
     }
 }
 /**
  * Creates a connection to the test database, if there is none yet, and
  * creates the necessary tables.
  */
 protected function setUp()
 {
     $forceCreateTables = false;
     if (!isset(static::$_sharedConn)) {
         static::$_sharedConn = TestUtil::getConnection();
         if (static::$_sharedConn->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
             $forceCreateTables = true;
         }
     }
     if (isset($GLOBALS['DOCTRINE_MARK_SQL_LOGS'])) {
         if (in_array(static::$_sharedConn->getDatabasePlatform()->getName(), array("mysql", "postgresql"))) {
             static::$_sharedConn->executeQuery('SELECT 1 /*' . get_class($this) . '*/');
         } else {
             if (static::$_sharedConn->getDatabasePlatform()->getName() == "oracle") {
                 static::$_sharedConn->executeQuery('SELECT 1 /*' . get_class($this) . '*/ FROM dual');
             }
         }
     }
     if (!$this->_em) {
         $this->_em = $this->_getEntityManager();
         $this->_schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
     }
     $classes = array();
     foreach ($this->_usedModelSets as $setName => $bool) {
         if (!isset(static::$_tablesCreated[$setName])) {
             foreach (static::$_modelSets[$setName] as $className) {
                 $classes[] = $this->_em->getClassMetadata($className);
             }
             static::$_tablesCreated[$setName] = true;
         }
     }
     if ($classes) {
         $this->_schemaTool->createSchema($classes);
     }
     $this->_sqlLoggerStack->enabled = true;
 }
 protected function setUp()
 {
     if (!isset($this->sharedFixture['conn'])) {
         $this->sharedFixture['conn'] = TestUtil::getConnection();
     }
 }
 /**
  * Creates a connection to the test database, if there is none yet, and
  * creates the necessary tables.
  */
 protected function setUp()
 {
     $forceCreateTables = false;
     if (!isset($this->sharedFixture['conn'])) {
         if (!isset(static::$_sharedConn)) {
             static::$_sharedConn = TestUtil::getConnection();
         }
         $this->sharedFixture['conn'] = static::$_sharedConn;
         if ($this->sharedFixture['conn']->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
             $forceCreateTables = true;
         }
     }
     if (!$this->_em) {
         $this->_em = $this->_getEntityManager();
         $this->_schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
     }
     $classes = array();
     foreach ($this->_usedModelSets as $setName => $bool) {
         if (!isset(static::$_tablesCreated[$setName])) {
             foreach (static::$_modelSets[$setName] as $className) {
                 $classes[] = $this->_em->getClassMetadata($className);
             }
             static::$_tablesCreated[$setName] = true;
         }
     }
     if ($classes) {
         $this->_schemaTool->createSchema($classes);
     }
     $this->_sqlLoggerStack->enabled = true;
 }