aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-06-11 13:24:55 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-06-11 13:24:55 +0200
commit5e8054f04598c449799a594fcb96cfeb8abf925a (patch)
tree2355b72ab20413b1352e7be5b1409199e8fb0861 /tests/test_framework
parenta7e3a1b3760ddd7aeb2208bebe89283534d62790 (diff)
downloadforums-5e8054f04598c449799a594fcb96cfeb8abf925a.tar
forums-5e8054f04598c449799a594fcb96cfeb8abf925a.tar.gz
forums-5e8054f04598c449799a594fcb96cfeb8abf925a.tar.bz2
forums-5e8054f04598c449799a594fcb96cfeb8abf925a.tar.xz
forums-5e8054f04598c449799a594fcb96cfeb8abf925a.zip
[ticket/11601] Split post_setup_synchronisation logic from xml parsing
PHPBB3-11601
Diffstat (limited to 'tests/test_framework')
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index bcd52b1794..30f1fa6589 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -481,11 +481,32 @@ class phpbb_database_test_connection_manager
*/
public function post_setup_synchronisation($xml_data_set)
{
+ $table_names = $xml_data_set->getTableNames();
+
+ $tables = array();
+ foreach ($table_names as $table)
+ {
+ $tables[$table] = $xml_data_set->getTableMetaData($table)->getColumns();
+ }
+
+ $this->database_synchronisation($tables);
+ }
+
+ /**
+ * Performs synchronisations on the database after a fixture has been loaded
+ *
+ * @param array $table_column_map Array of tables/columns to synchronise
+ * array(table1 => array(column1, column2))
+ *
+ * @return null
+ */
+ public function database_synchronisation($table_column_map)
+ {
$this->ensure_connected(__METHOD__);
$queries = array();
- // Get escaped versions of the table names used in the fixture
- $table_names = array_map(array($this->pdo, 'PDO::quote'), $xml_data_set->getTableNames());
+ // Get escaped versions of the table names to synchronise
+ $table_names = array_map(array($this->pdo, 'PDO::quote'), array_keys($table_column_map));
switch ($this->config['dbms'])
{
@@ -542,7 +563,7 @@ class phpbb_database_test_connection_manager
while ($row = $result->fetch(PDO::FETCH_ASSOC))
{
// Get the columns used in the fixture for this table
- $column_names = $xml_data_set->getTableMetaData($row['table_name'])->getColumns();
+ $column_names = $table_column_map[$row['table_name']];
// Skip sequences that weren't specified in the fixture
if (!in_array($row['column_name'], $column_names))