public function setUp($connection_name = null) { require_once 'DatabaseLoader.php'; Table::clearCache(); $config = Config::instance(); $this->original_default_connection = $config->getDefaultConnection(); if ($connection_name) { $config->setDefaultConnection($connection_name); } /* if ($connection_name === 'sqlite' || $config->getDefaultConnection() === 'sqlite') { // need to create the db. the adapter specifically does not create it for us. //static::$db = \substr(Config::instance()->getConnection('sqlite'), 9); //new Sqlite(static::$db); //$file_db = new PDO('sqlite:messaging.sqlite3'); if ($GLOBALS['OS'] !== 'WIN') { new \PDO('sqlite:../Fixtures/test.db'); } else { new \PDO('sqlite:../Fixtures/test.db'); } var_dump($config); var_dump($GLOBALS['OS']); exit(); } */ $this->connection_name = $connection_name; try { $this->conn = ConnectionManager::getConnection($connection_name); } catch (ExceptionDatabase $e) { $this->markTestSkipped($connection_name . ' failed to connect. ' . $e->getMessage()); } $GLOBALS['Activerecord_LOG'] = false; $loader = new DatabaseLoader($this->conn); $loader->resetTableData(); if (self::$log) { $GLOBALS['Activerecord_LOG'] = true; } }