1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-29 21:10:31 +02:00

[feature/functional-tests] Configure functional tests through config file

The functional tests now also use the test database

PHPBB3-10414
This commit is contained in:
Nils Adermann
2011-10-14 16:05:35 +02:00
parent 637d8eabe7
commit 0ffe494edd
3 changed files with 86 additions and 60 deletions

View File

@@ -46,4 +46,56 @@ class phpbb_test_case_helpers
{
mkdir($path, 0777, true);
}
static public function get_test_config()
{
if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>='))
{
$config = array(
'dbms' => 'sqlite',
'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename
'dbport' => '',
'dbname' => '',
'dbuser' => '',
'dbpasswd' => '',
'phpbb_functional_url' => 'http://localhost/',
);
}
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,
'phpbb_functional_url' => isset($phpbb_functional_url) ? $phpbb_functional_url : 'http://localhost/',
));
}
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;
}
}