aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-12-06 22:45:12 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-06 22:45:12 -0500
commitebdd96592a100139c48204ef133e706c0ac465d1 (patch)
treea928e3bb37b8faeec1db80d0b92c1e693062d76f /tests
parentd33accb687ab4266559c12a356e121f3634d780b (diff)
downloadforums-ebdd96592a100139c48204ef133e706c0ac465d1.tar
forums-ebdd96592a100139c48204ef133e706c0ac465d1.tar.gz
forums-ebdd96592a100139c48204ef133e706c0ac465d1.tar.bz2
forums-ebdd96592a100139c48204ef133e706c0ac465d1.tar.xz
forums-ebdd96592a100139c48204ef133e706c0ac465d1.zip
[ticket/10972] Backport get_db from develop.
PHPBB3-10972
Diffstat (limited to 'tests')
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 9bc2c96753..3b6232d091 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -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)