mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/10678] Add better support for Firebird, Oracle, and MSSQL
Allow ODBC connections for Firebird Capitalize fixture tables and columns for Firebird On database drop failure, drop all tables Provide cleanup utilities for databases that cannot be dropped PHPBB3-10678
This commit is contained in:
@@ -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);
|
||||
|
||||
$temp = tmpfile();
|
||||
fwrite($temp, $xml_data);
|
||||
fseek($temp, 0);
|
||||
|
||||
$meta_data = stream_get_meta_data($temp);
|
||||
$path = $meta_data['uri'];
|
||||
}
|
||||
|
||||
return parent::createXMLDataSet($path);
|
||||
}
|
||||
|
||||
public function get_test_case_helpers()
|
||||
{
|
||||
if (!$this->test_case_helpers)
|
||||
@@ -106,4 +128,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
{
|
||||
return new phpbb_database_test_connection_manager($config);
|
||||
}
|
||||
|
||||
public static function to_upper($matches)
|
||||
{
|
||||
return $matches[1] . strtoupper($matches[2]) . $matches[3];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user