aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework/phpbb_database_test_connection_manager.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-10-07 14:53:03 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-10-07 14:55:08 +0200
commit4fe95d6870ab1700f104b16223791933c8e50ff9 (patch)
treedbbe016a8adc201a949ffeac74aff135931534b5 /tests/test_framework/phpbb_database_test_connection_manager.php
parent943f2e1a7ba9264dcf0ec4c2b0f4f8e89a07b5ce (diff)
downloadforums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar
forums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar.gz
forums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar.bz2
forums-4fe95d6870ab1700f104b16223791933c8e50ff9.tar.xz
forums-4fe95d6870ab1700f104b16223791933c8e50ff9.zip
[ticket/13137] Generate the schema when the schema.json file is not available
PHPBB3-13137
Diffstat (limited to 'tests/test_framework/phpbb_database_test_connection_manager.php')
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index 92e2080dba..5d643e43e2 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -356,8 +356,23 @@ class phpbb_database_test_connection_manager
}
// Ok we have the db info go ahead and work on building the table
- $db_table_schema = file_get_contents($directory . 'schema.json');
- $db_table_schema = json_decode($db_table_schema, true);
+ if (file_exists($directory . 'schema.json'))
+ {
+ $db_table_schema = file_get_contents($directory . 'schema.json');
+ $db_table_schema = json_decode($db_table_schema, true);
+ }
+ else
+ {
+ global $phpbb_root_path, $phpEx, $table_prefix;
+
+ $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx);
+ $classes = $finder->core_path('phpbb/db/migration/data/')
+ ->get_classes();
+
+ $db = new \phpbb\db\driver\sqlite();
+ $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix);
+ $db_table_schema = $schema_generator->get_schema();
+ }
$db_tools = new \phpbb\db\tools($db, true);
foreach ($db_table_schema as $table_name => $table_data)