aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework/phpbb_database_test_case.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2012-07-17 21:10:41 +0200
committerNils Adermann <naderman@naderman.de>2012-07-17 21:12:47 +0200
commit4a87bc2aa92b086bbc04a735cb0d1564e4d0c903 (patch)
tree02c5f00e21ca2fef92a510dca70fd33a3668b008 /tests/test_framework/phpbb_database_test_case.php
parent0f70c930df3d5fbcfcf1855555757749a9c1a0fb (diff)
parent29b36b214a809b6ae49f941a4e3965ffba2b8741 (diff)
downloadforums-4a87bc2aa92b086bbc04a735cb0d1564e4d0c903.tar
forums-4a87bc2aa92b086bbc04a735cb0d1564e4d0c903.tar.gz
forums-4a87bc2aa92b086bbc04a735cb0d1564e4d0c903.tar.bz2
forums-4a87bc2aa92b086bbc04a735cb0d1564e4d0c903.tar.xz
forums-4a87bc2aa92b086bbc04a735cb0d1564e4d0c903.zip
Merge remote-tracking branch 'github-noxwizard/ticket/10678' into develop-olympus
* github-noxwizard/ticket/10678: [ticket/10678] Typo and formatting [ticket/10678] Add port handling for MSSQL tests [ticket/10678] Move config changes to new location [ticket/10678] Rename helper class file [ticket/10678] Lowercase class name, adjust comment width [ticket/10678] More formatting and docblocks [ticket/10678] More formatting requests [ticket/10678] Fix formatting [ticket/10678] Add better support for Firebird, Oracle, and MSSQL Conflicts: tests/RUNNING_TESTS.txt
Diffstat (limited to 'tests/test_framework/phpbb_database_test_case.php')
-rw-r--r--tests/test_framework/phpbb_database_test_case.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index e742b543b0..bb86df0ef0 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -28,6 +28,28 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
);
}
+ public function createXMLDataSet($path)
+ {
+ $db_config = $this->get_database_config();
+
+ // Firebird requires table and column names to be uppercase
+ if ($db_config['dbms'] == 'firebird')
+ {
+ $xml_data = file_get_contents($path);
+ $xml_data = preg_replace_callback('/(?:(<table name="))([a-z_]+)(?:(">))/', 'phpbb_database_test_case::to_upper', $xml_data);
+ $xml_data = preg_replace_callback('/(?:(<column>))([a-z_]+)(?:(<\/column>))/', 'phpbb_database_test_case::to_upper', $xml_data);
+
+ $new_fixture = tmpfile();
+ fwrite($new_fixture, $xml_data);
+ fseek($new_fixture, 0);
+
+ $meta_data = stream_get_meta_data($new_fixture);
+ $path = $meta_data['uri'];
+ }
+
+ return parent::createXMLDataSet($path);
+ }
+
public function get_test_case_helpers()
{
if (!$this->test_case_helpers)
@@ -106,4 +128,17 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
{
return new phpbb_database_test_connection_manager($config);
}
+
+ /**
+ * Converts a match in the middle of a string to uppercase.
+ * This is necessary for transforming the fixture information for Firebird tests
+ *
+ * @param $matches The array of matches from a regular expression
+ *
+ * @return string The string with the specified match converted to uppercase
+ */
+ public static function to_upper($matches)
+ {
+ return $matches[1] . strtoupper($matches[2]) . $matches[3];
+ }
}