1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 08:17:47 +02:00

Merge pull request #5808 from marc1706/ticket/16284

[ticket/16284] Move 4.0 migrations to v400 folder
This commit is contained in:
Marc Alexander
2020-01-14 21:20:09 +01:00
committed by GitHub
38 changed files with 625 additions and 352 deletions

View File

@@ -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()));
}
@@ -353,4 +352,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;
}
}

View File

@@ -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();
}

View File

@@ -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()
);

View File

@@ -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()
);