diff options
author | Nils Adermann <naderman@naderman.de> | 2014-03-29 16:29:33 -0400 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2014-03-29 16:29:33 -0400 |
commit | 308e8b0c9689334ef45fad9a9ed0f0ae63746bc7 (patch) | |
tree | 8f31cf74280c12ef0aae139b24e1ed78207b8445 /tests/test_framework | |
parent | f426fa02951b5131f77ad2c4596a0bd87ef23d84 (diff) | |
parent | 8824a53b0a539d63fe10e5e12ef1889fe90d4187 (diff) | |
download | forums-308e8b0c9689334ef45fad9a9ed0f0ae63746bc7.tar forums-308e8b0c9689334ef45fad9a9ed0f0ae63746bc7.tar.gz forums-308e8b0c9689334ef45fad9a9ed0f0ae63746bc7.tar.bz2 forums-308e8b0c9689334ef45fad9a9ed0f0ae63746bc7.tar.xz forums-308e8b0c9689334ef45fad9a9ed0f0ae63746bc7.zip |
Merge remote-tracking branch 'github-nickvergessen/ticket/11459' into develop-ascraeus
* github-nickvergessen/ticket/11459: (21 commits)
[ticket/11459] Make 3.1.0-dev migration depend on migrations_table
[ticket/11459] Move $supported_dbms to beginning of create schema file
[ticket/11459] Fix missing constant CONFIG_TABLE for sql_create_index()
[ticket/11459] Fix auth provider test
[ticket/11459] Correctly set up the database from schema in unit tests
[ticket/11459] Install DB schema from json file
[ticket/11459] Clean up a little more
[ticket/11459] Do not add table schema to database schema files
[ticket/11459] Create schema.json from migration files
[ticket/11459] Do not take files of extensions into account
[ticket/11459] Pass array with migration class names to schema generator
[ticket/11459] Refresh schema files
[ticket/11459] Remove spaces from the end of lines in MSSQL
[ticket/11459] Correctly handle index column length
[ticket/11459] Add migration for migrations table
[ticket/11459] Update doc blocks
[ticket/11459] Remove old schema file
[ticket/11459] Update schema files with new script
[ticket/11459] Use new migration/schema_generator to create schema files
[ticket/11459] Add Schema from 3.0.0
...
Diffstat (limited to 'tests/test_framework')
-rw-r--r-- | tests/test_framework/phpbb_database_test_case.php | 2 | ||||
-rw-r--r-- | tests/test_framework/phpbb_database_test_connection_manager.php | 23 |
2 files changed, 21 insertions, 4 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 4c2e9ff600..aacdb1bef4 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -138,7 +138,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test if (!self::$already_connected) { - $manager->load_schema(); + $manager->load_schema($this->new_dbal()); self::$already_connected = true; } diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index af9bd22662..5d8dae4a30 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -169,12 +169,12 @@ class phpbb_database_test_connection_manager /** * Load the phpBB database schema into the database */ - public function load_schema() + public function load_schema($db) { $this->ensure_connected(__METHOD__); $directory = dirname(__FILE__) . '/../../phpBB/install/schemas/'; - $this->load_schema_from_file($directory); + $this->load_schema_from_file($directory, $db); } /** @@ -321,7 +321,7 @@ class phpbb_database_test_connection_manager * Compile the correct schema filename (as per create_schema_files) and * load it into the database. */ - protected function load_schema_from_file($directory) + protected function load_schema_from_file($directory, \phpbb\db\driver\driver $db) { $schema = $this->dbms['SCHEMA']; @@ -351,6 +351,23 @@ class phpbb_database_test_connection_manager { $this->pdo->exec($query); } + + // 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); + + $db_tools = new \phpbb\db\tools($db, true); + foreach ($db_table_schema as $table_name => $table_data) + { + $queries = $db_tools->sql_create_table( + $table_name, + $table_data + ); + foreach ($queries as $query) + { + $this->pdo->exec($query); + } + } } /** |