aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2010-09-16 23:17:52 +0200
committerIgor Wiedler <igor@wiedler.ch>2010-09-16 23:17:52 +0200
commit2376f077415814b0a113c1095ad49038e0186a98 (patch)
tree2634dba53dd43d8748dd3bf9011838c0f2cee0d3
parente35711ddde8f5e9f94d4b5145662877619ceecd4 (diff)
parented783506c6775cb73813261d3c29ae8e0652c4e8 (diff)
downloadforums-2376f077415814b0a113c1095ad49038e0186a98.tar
forums-2376f077415814b0a113c1095ad49038e0186a98.tar.gz
forums-2376f077415814b0a113c1095ad49038e0186a98.tar.bz2
forums-2376f077415814b0a113c1095ad49038e0186a98.tar.xz
forums-2376f077415814b0a113c1095ad49038e0186a98.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/9825] Add unit test config and db to gitignore [ticket/9825] Unit tests: Use sqlite when possible and no test_config exists.
-rw-r--r--.gitignore4
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php37
2 files changed, 29 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 3e0f454e0c..2b9eef7fce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
phpBB/cache/*.php
-*~ \ No newline at end of file
+tests/phpbb_unit_tests.sqlite2
+tests/test_config.php
+*~
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()