/** * Get database connection which will be used by PHPUnit * for clean-up and fixture loading into the test DB. * * @return PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection */ public final function getConnection() { $this->factory = NDB_Factory::singleton(); if ($this->_conn === null) { if (self::$_pdo == null) { self::$_pdo = new PDO('mysql:dbname=' . $this->factory->settings()->dbName() . '; host=' . $this->factory->settings()->dbHost(), $this->factory->settings()->dbUserName(), $this->factory->settings()->dbPassword()); } $this->_conn = $this->createDefaultDBConnection(self::$_pdo); } return $this->_conn; }
/** * Get database connection which will be used by PHPUnit * for clean-up and fixture loading into the test DB. * * @return PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection */ public final function getConnection() { $this->factory = NDB_Factory::singleton(); $this->config = $this->factory->Config(CONFIG_XML); $database = $this->config->getSetting('database'); if ($this->_conn === null) { if (self::$_pdo == null) { self::$_pdo = new PDO('mysql:dbname=' . $database['database'] . ';host=' . $database['host'], $database['username'], $database['password']); } $this->_conn = $this->createDefaultDBConnection(self::$_pdo); } return $this->_conn; }