mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-07 16:15:22 +02:00
[ticket/10972] Backport get_db from develop.
PHPBB3-10972
This commit is contained in:
parent
d33accb687
commit
ebdd96592a
@ -16,7 +16,9 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
{
|
{
|
||||||
protected $client;
|
protected $client;
|
||||||
protected $root_url;
|
protected $root_url;
|
||||||
|
|
||||||
protected $cache = null;
|
protected $cache = null;
|
||||||
|
protected $db = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session ID for current test's session (each test makes its own)
|
* 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()
|
protected function get_cache_driver()
|
||||||
{
|
{
|
||||||
if (!$this->cache)
|
if (!$this->cache)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user