diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-11-16 01:50:30 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-11-16 01:50:30 +0100 |
commit | 8f8a7f76374679d2f893245c1f607a3b2db56a9a (patch) | |
tree | 8c26018ff0deae7e109e43b30cce014a276dd4c6 | |
parent | fc5385c2a58833af2929c75d132903a3a0918da9 (diff) | |
download | forums-8f8a7f76374679d2f893245c1f607a3b2db56a9a.tar forums-8f8a7f76374679d2f893245c1f607a3b2db56a9a.tar.gz forums-8f8a7f76374679d2f893245c1f607a3b2db56a9a.tar.bz2 forums-8f8a7f76374679d2f893245c1f607a3b2db56a9a.tar.xz forums-8f8a7f76374679d2f893245c1f607a3b2db56a9a.zip |
[ticket/11015] Allow full dbms class name in tests/test_config.php
PHPBB3-11015
-rw-r--r-- | tests/test_framework/phpbb_test_case_helpers.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 5c1200657d..9bbdcff440 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -78,7 +78,7 @@ class phpbb_test_case_helpers include($test_config); $config = array_merge($config, array( - 'dbms' => 'phpbb_db_driver_' . $dbms, + 'dbms' => $this->convert_30_dbms($dbms), 'dbhost' => $dbhost, 'dbport' => $dbport, 'dbname' => $dbname, @@ -96,7 +96,7 @@ class phpbb_test_case_helpers if (isset($_SERVER['PHPBB_TEST_DBMS'])) { $config = array_merge($config, array( - 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? 'phpbb_db_driver_' . $_SERVER['PHPBB_TEST_DBMS'] : '', + 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $this->convert_30_dbms($_SERVER['PHPBB_TEST_DBMS']) : '', 'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '', 'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '', 'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '', @@ -223,4 +223,20 @@ class phpbb_test_case_helpers } } } + + /** + * Convert 3.0 dbms to 3.1 db driver class name + * + * @param string $dbms dbms parameter + * @return db driver class + */ + protected function convert_30_dbms($dbms) + { + if (!preg_match('#^phpbb_db_driver_#', $dbms)) + { + return 'phpbb_db_driver_'.$dbms; + } + + return $dbms; + } } |