mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge branch 'ticket/bantu/9825' into develop-olympus
* ticket/bantu/9825: [ticket/9825] Add unit test config and db to gitignore [ticket/9825] Unit tests: Use sqlite when possible and no test_config exists.
This commit is contained in:
commit
ed783506c6
2 changed files with 29 additions and 12 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
phpBB/cache/*.php
|
phpBB/cache/*.php
|
||||||
|
tests/phpbb_unit_tests.sqlite2
|
||||||
|
tests/test_config.php
|
||||||
*~
|
*~
|
|
@ -22,7 +22,32 @@ class phpbb_test_case_helpers
|
||||||
{
|
{
|
||||||
static $show_error = true;
|
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)
|
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);
|
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()
|
public function new_dbal()
|
||||||
|
|
Loading…
Add table
Reference in a new issue