1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 06:20:46 +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

@@ -69,6 +69,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
dirname(__FILE__) . '/../../phpBB/',
'php',
'phpbb_',
self::get_core_tables(),
$tools,
new \phpbb\db\migration\helper()
);

View File

@@ -167,6 +167,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$phpbb_root_path,
$php_ext,
$table_prefix,
self::get_core_tables(),
array(),
new \phpbb\db\migration\helper()
);

View File

@@ -87,6 +87,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->phpbb_root_path,
'php',
$this->table_prefix,
self::get_core_tables(),
array(),
new \phpbb\db\migration\helper()
);

View File

@@ -64,7 +64,8 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case
$factory->get($this->db),
$phpbb_root_path,
$phpEx,
'phpbb_'
'phpbb_',
self::get_core_tables()
);
}

View File

@@ -43,6 +43,7 @@ class get_callable_from_step_test extends phpbb_database_test_case
$phpbb_root_path,
$php_ext,
$table_prefix,
self::get_core_tables(),
array($module_tools),
new \phpbb\db\migration\helper()
);

View File

@@ -41,7 +41,7 @@ class schema_generator_test extends phpbb_test_case
protected function get_schema_generator(array $class_names)
{
$this->generator = new \phpbb\db\migration\schema_generator($class_names, $this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix);
$this->generator = new \phpbb\db\migration\schema_generator($class_names, $this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix, phpbb_database_test_case::get_core_tables());
return $this->generator;
}

View File

@@ -36,7 +36,8 @@ class phpbb_notification_convert_test extends phpbb_database_test_case
$factory->get($this->db),
$phpbb_root_path,
$phpEx,
'phpbb_'
'phpbb_',
self::get_core_tables()
);
}

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