aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_framework')
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php23
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php27
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php5
3 files changed, 42 insertions, 13 deletions
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index 03097a10a0..29058cc815 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -186,6 +186,16 @@ class phpbb_database_test_connection_manager
$this->purge_extras();
break;
+ case 'phpbb_db_driver_postgres':
+ $this->connect();
+ // Drop all of the tables
+ foreach ($this->get_tables() as $table)
+ {
+ $this->pdo->exec('DROP TABLE ' . $table . ' CASCADE');
+ }
+ $this->purge_extras();
+ break;
+
default:
$this->connect(false);
@@ -418,6 +428,19 @@ class phpbb_database_test_connection_manager
$queries[] = 'DROP SEQUENCE ' . current($row);
}
break;
+
+ case 'phpbb_db_driver_postgres':
+ $sql = 'SELECT sequence_name
+ FROM information_schema.sequences';
+ $result = $this->pdo->query($sql);
+
+ while ($row = $result->fetch(PDO::FETCH_NUM))
+ {
+ $queries[] = 'DROP SEQUENCE ' . current($row);
+ }
+
+ $queries[] = 'DROP TYPE IF EXISTS varchar_ci CASCADE';
+ break;
}
foreach ($queries as $query)
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index e346223a4b..b570b464e6 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -134,19 +134,20 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
- if (!$this->extension_manager)
- {
- $this->extension_manager = new phpbb_extension_manager(
- $this->get_db(),
- new phpbb_config(array()),
- self::$config['table_prefix'] . 'ext',
- $phpbb_root_path,
- ".$phpEx",
- $this->get_cache_driver()
- );
- }
-
- return $this->extension_manager;
+ $config = new phpbb_config(array());
+ $db = $this->get_db();
+ $db_tools = new phpbb_db_tools($db);
+
+ return new phpbb_extension_manager(
+ new phpbb_mock_container_builder(),
+ $db,
+ $config,
+ new phpbb_db_migrator($config, $db, $db_tools, self::$config['table_prefix'] . 'migrations', $phpbb_root_path, $php_ext, self::$config['table_prefix'], array()),
+ self::$config['table_prefix'] . 'ext',
+ dirname(__FILE__) . '/',
+ '.' . $php_ext,
+ $this->get_cache_driver()
+ );
}
static protected function install_board()
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 47459832d5..20ae384f21 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -77,6 +77,11 @@ class phpbb_test_case_helpers
{
include($test_config);
+ if (!function_exists('phpbb_convert_30_dbms_to_31'))
+ {
+ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+ }
+
$config = array_merge($config, array(
'dbms' => phpbb_convert_30_dbms_to_31($dbms),
'dbhost' => $dbhost,