mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/16284] Adjust create schema and add tables to tests
PHPBB3-16284
This commit is contained in:
@@ -75,14 +75,13 @@ abstract class phpbb_database_test_case extends TestCase
|
||||
|
||||
if (!file_exists(self::$schema_file))
|
||||
{
|
||||
|
||||
global $table_prefix;
|
||||
|
||||
$db = new \phpbb\db\driver\sqlite3();
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($db, true);
|
||||
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix, self::get_core_tables());
|
||||
file_put_contents(self::$schema_file, json_encode($schema_generator->get_schema()));
|
||||
}
|
||||
|
||||
@@ -319,4 +318,23 @@ abstract class phpbb_database_test_case extends TestCase
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
static public function get_core_tables() : array
|
||||
{
|
||||
global $phpbb_root_path, $table_prefix;
|
||||
|
||||
static $core_tables = [];
|
||||
|
||||
if (empty($tables))
|
||||
{
|
||||
$tables_yml_data = \Symfony\Component\Yaml\Yaml::parseFile($phpbb_root_path . '/config/default/container/tables.yml');
|
||||
|
||||
foreach ($tables_yml_data['parameters'] as $parameter => $table)
|
||||
{
|
||||
$core_tables[str_replace('tables.', '', $parameter)] = str_replace('%core.table_prefix%', $table_prefix, $table);
|
||||
}
|
||||
}
|
||||
|
||||
return $core_tables;
|
||||
}
|
||||
}
|
||||
|
@@ -372,8 +372,9 @@ class phpbb_database_test_connection_manager
|
||||
$db = new \phpbb\db\driver\sqlite3();
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($db, true);
|
||||
$tables = phpbb_database_test_case::get_core_tables();
|
||||
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix, $tables);
|
||||
$db_table_schema = $schema_generator->get_schema();
|
||||
}
|
||||
|
||||
|
@@ -249,6 +249,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
$phpbb_root_path,
|
||||
$phpEx,
|
||||
self::$config['table_prefix'],
|
||||
phpbb_database_test_case::get_core_tables(),
|
||||
array(),
|
||||
new \phpbb\db\migration\helper()
|
||||
);
|
||||
|
@@ -486,6 +486,7 @@ class phpbb_ui_test_case extends phpbb_test_case
|
||||
$phpbb_root_path,
|
||||
$phpEx,
|
||||
self::$config['table_prefix'],
|
||||
phpbb_database_test_case::get_core_tables(),
|
||||
array(),
|
||||
new \phpbb\db\migration\helper()
|
||||
);
|
||||
|
Reference in New Issue
Block a user