aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework/phpbb_test_case_helpers.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2012-04-21 12:31:43 +0200
committerNils Adermann <naderman@naderman.de>2012-04-21 12:31:43 +0200
commitcdf7ff17974eb20f37b25998036a723ea783a381 (patch)
treecb6fe83f4907aa71f62564438b845be587082b63 /tests/test_framework/phpbb_test_case_helpers.php
parent29a6aec9ad312bb11e19295f0b8d44efbc86d933 (diff)
parent6293bbf09949335bb8101bcef8f043750d756dc9 (diff)
downloadforums-cdf7ff17974eb20f37b25998036a723ea783a381.tar
forums-cdf7ff17974eb20f37b25998036a723ea783a381.tar.gz
forums-cdf7ff17974eb20f37b25998036a723ea783a381.tar.bz2
forums-cdf7ff17974eb20f37b25998036a723ea783a381.tar.xz
forums-cdf7ff17974eb20f37b25998036a723ea783a381.zip
Merge remote-tracking branch 'github-noxwizard/ticket/10492' into develop-olympus
* github-noxwizard/ticket/10492: [ticket/10492] Fix line endings [ticket/10492] Backporting functional tests [ticket/10492] Separate config generation from the installer
Diffstat (limited to 'tests/test_framework/phpbb_test_case_helpers.php')
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 9a7ab2d237..b46c36efaa 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -41,4 +41,61 @@ class phpbb_test_case_helpers
$this->expectedTriggerError = true;
$this->test_case->setExpectedException($exceptionName, (string) $message, $errno);
}
+
+ static public function get_test_config()
+ {
+ $config = array();
+
+ if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>='))
+ {
+ $config = array_merge($config, array(
+ 'dbms' => 'sqlite',
+ 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename
+ 'dbport' => '',
+ 'dbname' => '',
+ 'dbuser' => '',
+ 'dbpasswd' => '',
+ ));
+ }
+
+ if (file_exists(dirname(__FILE__) . '/../test_config.php'))
+ {
+ include(dirname(__FILE__) . '/../test_config.php');
+
+ $config = array_merge($config, array(
+ 'dbms' => $dbms,
+ 'dbhost' => $dbhost,
+ 'dbport' => $dbport,
+ 'dbname' => $dbname,
+ 'dbuser' => $dbuser,
+ 'dbpasswd' => $dbpasswd,
+ ));
+
+ if (isset($phpbb_functional_url))
+ {
+ $config['phpbb_functional_url'] = $phpbb_functional_url;
+ }
+ }
+
+ if (isset($_SERVER['PHPBB_TEST_DBMS']))
+ {
+ $config = array_merge($config, array(
+ 'dbms' => isset($_SERVER['PHPBB_TEST_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'] : '',
+ 'dbuser' => isset($_SERVER['PHPBB_TEST_DBUSER']) ? $_SERVER['PHPBB_TEST_DBUSER'] : '',
+ 'dbpasswd' => isset($_SERVER['PHPBB_TEST_DBPASSWD']) ? $_SERVER['PHPBB_TEST_DBPASSWD'] : ''
+ ));
+ }
+
+ if (isset($_SERVER['PHPBB_FUNCTIONAL_URL']))
+ {
+ $config = array_merge($config, array(
+ 'phpbb_functional_url' => isset($_SERVER['PHPBB_FUNCTIONAL_URL']) ? $_SERVER['PHPBB_FUNCTIONAL_URL'] : '',
+ ));
+ }
+
+ return $config;
+ }
}