aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2020-01-01 16:17:23 +0100
committerMarc Alexander <admin@m-a-styles.de>2020-01-01 16:17:23 +0100
commit2b65ce123cec682a7b1b6037c93259bc5abccb44 (patch)
treeee453146d5aef42038ab20d2e1e84dacab4c492f /tests
parent[ticket/16284] Add effectively installed checks where applicable (diff)
downloadphpbb-2b65ce123cec682a7b1b6037c93259bc5abccb44.tar.gz
phpbb-2b65ce123cec682a7b1b6037c93259bc5abccb44.tar.bz2
phpbb-2b65ce123cec682a7b1b6037c93259bc5abccb44.zip
[ticket/16284] Adjust create schema and add tables to tests
PHPBB3-16284
Diffstat (limited to 'tests')
-rw-r--r--tests/dbal/migrator_test.php1
-rw-r--r--tests/extension/manager_test.php1
-rw-r--r--tests/extension/metadata_manager_test.php1
-rw-r--r--tests/migrator/convert_timezones_test.php3
-rw-r--r--tests/migrator/get_callable_from_step_test.php1
-rw-r--r--tests/migrator/schema_generator_test.php2
-rw-r--r--tests/notification/convert_test.php3
-rw-r--r--tests/test_framework/phpbb_database_test_case.php22
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php3
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php1
-rw-r--r--tests/test_framework/phpbb_ui_test_case.php1
11 files changed, 33 insertions, 6 deletions
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index 1f6cf3c8a3..947da726b3 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -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()
);
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index 128192fa0c..5eac7d1951 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -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()
);
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index 38b821c7b4..2e1a85a013 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -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()
);
diff --git a/tests/migrator/convert_timezones_test.php b/tests/migrator/convert_timezones_test.php
index 4bb0aec34f..5bb8d7ab93 100644
--- a/tests/migrator/convert_timezones_test.php
+++ b/tests/migrator/convert_timezones_test.php
@@ -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()
);
}
diff --git a/tests/migrator/get_callable_from_step_test.php b/tests/migrator/get_callable_from_step_test.php
index b0abb6199c..809b977d57 100644
--- a/tests/migrator/get_callable_from_step_test.php
+++ b/tests/migrator/get_callable_from_step_test.php
@@ -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()
);
diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php
index 1349b98953..dd7158cbfd 100644
--- a/tests/migrator/schema_generator_test.php
+++ b/tests/migrator/schema_generator_test.php
@@ -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;
}
diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php
index d4a33ff537..d1707cc70f 100644
--- a/tests/notification/convert_test.php
+++ b/tests/notification/convert_test.php
@@ -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()
);
}
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index 0197b3c68d..5bce90990d 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -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;
+ }
}
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index b6ad7e7838..e4c1a194cc 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -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();
}
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 82f67c4e4c..2b17bd3c10 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -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()
);
diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php
index 61db3da3e9..1fbfd22dbe 100644
--- a/tests/test_framework/phpbb_ui_test_case.php
+++ b/tests/test_framework/phpbb_ui_test_case.php
@@ -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()
);