diff options
author | Andreas Fischer <bantu@phpbb.com> | 2010-09-16 00:03:52 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2010-09-16 00:03:52 +0200 |
commit | ac753fa8536b5d4a2e5a7d86e7fa922eb56ed561 (patch) | |
tree | 08c0a49b8ec22f76f1b94195b489882f9eecc94f /tests/test_framework/phpbb_test_case_helpers.php | |
parent | d874c3237498feb7729b23ee17248981ee3faadc (diff) | |
download | forums-ac753fa8536b5d4a2e5a7d86e7fa922eb56ed561.tar forums-ac753fa8536b5d4a2e5a7d86e7fa922eb56ed561.tar.gz forums-ac753fa8536b5d4a2e5a7d86e7fa922eb56ed561.tar.bz2 forums-ac753fa8536b5d4a2e5a7d86e7fa922eb56ed561.tar.xz forums-ac753fa8536b5d4a2e5a7d86e7fa922eb56ed561.zip |
[ticket/9825] Unit tests: Use sqlite when possible and no test_config exists.
PHPBB3-9825
Diffstat (limited to 'tests/test_framework/phpbb_test_case_helpers.php')
-rw-r--r-- | tests/test_framework/phpbb_test_case_helpers.php | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 0c5932e1ad..7c026e496e 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -22,7 +22,32 @@ class phpbb_test_case_helpers { static $show_error = true; - if (!file_exists('test_config.php')) + if (file_exists('test_config.php')) + { + include('test_config.php'); + + return array( + 'dbms' => $dbms, + 'dbhost' => $dbhost, + 'dbport' => $dbport, + 'dbname' => $dbname, + 'dbuser' => $dbuser, + 'dbpasswd' => $dbpasswd, + ); + } + else if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) + { + // Silently use sqlite + return array( + 'dbms' => 'sqlite', + 'dbhost' => 'phpbb_unit_tests.sqlite2', // filename + 'dbport' => '', + 'dbname' => '', + 'dbuser' => '', + 'dbpasswd' => '', + ); + } + else { if ($show_error) { @@ -46,16 +71,6 @@ class phpbb_test_case_helpers NOTE: The database is dropped and recreated with the phpbb-db-schema! Do NOT specify a database with important data.", E_USER_ERROR); } - include('test_config.php'); - - return array( - 'dbms' => $dbms, - 'dbhost' => $dbhost, - 'dbport' => $dbport, - 'dbname' => $dbname, - 'dbuser' => $dbuser, - 'dbpasswd' => $dbpasswd, - ); } public function new_dbal() |