summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-12-22 21:34:13 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-12-22 21:34:13 +0000
commita87da0d78a67c307a54ce735aa00b0c6cb11ad69 (patch)
tree9248f88397968f23ff5123ad10ad1511f14a933f /modules
parent1eb122344a6b383741265228cd2a286dc94ee8de (diff)
downloadbrdo-a87da0d78a67c307a54ce735aa00b0c6cb11ad69.tar.gz
brdo-a87da0d78a67c307a54ce735aa00b0c6cb11ad69.tar.bz2
#850852 by Damien Tournoud, dmitrig01, chx: Fixed transaction failure and allow concurrent testing on SQLite
Diffstat (limited to 'modules')
-rw-r--r--modules/simpletest/drupal_web_test_case.php27
1 files changed, 25 insertions, 2 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index e9d5ad43d..841451746 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1313,9 +1313,32 @@ class DrupalWebTestCase extends DrupalTestCase {
* set up a clean environment for the current test run.
*/
protected function preloadRegistry() {
+ // Use two separate queries, each with their own connections: copy the
+ // {registry} and {registry_file} tables over from the parent installation
+ // to the child installation.
$original_connection = Database::getConnection('default', 'simpletest_original_default');
- db_query('INSERT INTO {registry} SELECT * FROM ' . $original_connection->prefixTables('{registry}'));
- db_query('INSERT INTO {registry_file} SELECT * FROM ' . $original_connection->prefixTables('{registry_file}'));
+ $test_connection = Database::getConnection();
+
+ foreach (array('registry', 'registry_file') as $table) {
+ // Find the records from the parent database.
+ $source_query = $original_connection
+ ->select($table, array(), array('fetch' => PDO::FETCH_ASSOC))
+ ->fields($table);
+
+ $dest_query = $test_connection->insert($table);
+
+ $first = TRUE;
+ foreach ($source_query->execute() as $row) {
+ if ($first) {
+ $dest_query->fields(array_keys($row));
+ $first = FALSE;
+ }
+ // Insert the records into the child database.
+ $dest_query->values($row);
+ }
+
+ $dest_query->execute();
+ }
}
/**