1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 23:55:26 +02:00

[ticket/10972] Backport get_db from develop.

PHPBB3-10972
This commit is contained in:
Oleg Pudeyev 2012-12-06 22:45:12 -05:00
parent d33accb687
commit ebdd96592a

View File

@ -16,7 +16,9 @@ class phpbb_functional_test_case extends phpbb_test_case
{
protected $client;
protected $root_url;
protected $cache = null;
protected $db = null;
/**
* Session ID for current test's session (each test makes its own)
@ -70,6 +72,23 @@ class phpbb_functional_test_case extends phpbb_test_case
{
}
protected function get_db()
{
global $phpbb_root_path, $phpEx;
// so we don't reopen an open connection
if (!($this->db instanceof dbal))
{
if (!class_exists('dbal_' . self::$config['dbms']))
{
include($phpbb_root_path . 'includes/db/' . self::$config['dbms'] . ".$phpEx");
}
$sql_db = 'dbal_' . self::$config['dbms'];
$this->db = new $sql_db();
$this->db->sql_connect(self::$config['dbhost'], self::$config['dbuser'], self::$config['dbpasswd'], self::$config['dbname'], self::$config['dbport']);
}
return $this->db;
}
protected function get_cache_driver()
{
if (!$this->cache)