aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-12-03 22:25:32 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2011-12-03 22:25:32 -0500
commit0c0befe2f858ec2c53e92ab06455392c6bb118f0 (patch)
tree61f8da25d7a7cc5ee2ef3ea908b7486ef734b219 /tests
parent3176dcbc05383ab7cb72e228ab7b2ea1929643ab (diff)
parentbf6d501ab16f0557c0570faa2a6f45e588ff62fb (diff)
downloadforums-0c0befe2f858ec2c53e92ab06455392c6bb118f0.tar
forums-0c0befe2f858ec2c53e92ab06455392c6bb118f0.tar.gz
forums-0c0befe2f858ec2c53e92ab06455392c6bb118f0.tar.bz2
forums-0c0befe2f858ec2c53e92ab06455392c6bb118f0.tar.xz
forums-0c0befe2f858ec2c53e92ab06455392c6bb118f0.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/10349] Removed duplicated functions from schema loading in tests [ticket/10349] Update function comment [ticket/10349] Use new schema comment function in installer [ticket/10349] Unit tests: Consolidate schema comment removal functions [ticket/10349] Unit tests: Remove comments while loading schema files
Diffstat (limited to 'tests')
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php45
1 files changed, 7 insertions, 38 deletions
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index 68e09add94..7a45d87583 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -7,6 +7,8 @@
*
*/
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_install.php';
+
class phpbb_database_test_connection_manager
{
private $config;
@@ -239,7 +241,11 @@ class phpbb_database_test_connection_manager
}
$filename = $directory . $schema . '_schema.sql';
- $sql = $this->split_sql(file_get_contents($filename));
+
+ $queries = file_get_contents($filename);
+ $sql = remove_comments($queries);
+
+ $sql = split_sql_file($sql, $this->dbms['DELIM']);
foreach ($sql as $query)
{
@@ -248,43 +254,6 @@ class phpbb_database_test_connection_manager
}
/**
- * Split contents of an SQL file into an array of SQL statements
- *
- * Note: This method is not the same as split_sql_file from functions_install.
- *
- * @param string $sql Raw contents of an SQL file
- *
- * @return Array of runnable SQL statements
- */
- protected function split_sql($sql)
- {
- $sql = str_replace("\r" , '', $sql);
- $data = preg_split('/' . preg_quote($this->dbms['DELIM'], '/') . '$/m', $sql);
-
- $data = array_map('trim', $data);
-
- // The empty case
- $end_data = end($data);
-
- if (empty($end_data))
- {
- unset($data[key($data)]);
- }
-
- if ($this->config['dbms'] == 'sqlite')
- {
- // remove comment lines starting with # - they are not proper sqlite
- // syntax and break sqlite2
- foreach ($data as $i => $query)
- {
- $data[$i] = preg_replace('/^#.*$/m', "\n", $query);
- }
- }
-
- return $data;
- }
-
- /**
* Map a phpBB dbms driver name to dbms data array
*/
protected function get_dbms_data($dbms)