aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2010-09-15 08:28:46 +0200
committerIgor Wiedler <igor@wiedler.ch>2010-09-15 09:50:04 +0200
commita4742f795e8e20abeec915059f018dbe001383d7 (patch)
tree83166b19ee0ceaaa2d10fd991540278e110e49df /tests/test_framework
parent566ddf8a4b743a6d2d308c8fed912c354372d916 (diff)
downloadforums-a4742f795e8e20abeec915059f018dbe001383d7.tar
forums-a4742f795e8e20abeec915059f018dbe001383d7.tar.gz
forums-a4742f795e8e20abeec915059f018dbe001383d7.tar.bz2
forums-a4742f795e8e20abeec915059f018dbe001383d7.tar.xz
forums-a4742f795e8e20abeec915059f018dbe001383d7.zip
[ticket/9592] Slight adjustments to simplify db test cases
PHPBB3-9592
Diffstat (limited to 'tests/test_framework')
-rw-r--r--tests/test_framework/phpbb_database_test_case.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index a38f6719b3..f6bf420ebc 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -19,7 +19,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
}
}
- function get_dbms_data($dbms)
+ public function get_dbms_data($dbms)
{
$available_dbms = array(
'firebird' => array(
@@ -79,10 +79,13 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
}
}
- function split_sql_file($sql, $delimiter, $dbms)
+ // NOTE: This function is not the same as split_sql_file from functions_install
+ public function split_sql_file($sql, $dbms)
{
+ $dbms_data = $this->get_dbms_data($dbms);
+
$sql = str_replace("\r" , '', $sql);
- $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);
+ $data = preg_split('/' . preg_quote($dbms_data['DELIM'], '/') . '$/m', $sql);
$data = array_map('trim', $data);
@@ -99,13 +102,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
// trim # off query to satisfy sqlite
foreach ($data as $i => $query)
{
- $lines = explode("\n", $query);
- foreach ($lines as $j => $line)
- if (strpos($line, '#') === 0)
- {
- unset($lines[$j]);
- }
- $data[$i] = implode("\n", $lines);
+ $data[$i] = preg_replace('/^#.*$/m', "\n", $query);
}
}
@@ -177,7 +174,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
unset($row, $sth);
}
- $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $dbms_data['DELIM'], $database_config['dbms']);
+ $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $database_config['dbms']);
foreach ($sql_query as $sql)
{