diff options
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 2 | ||||
-rw-r--r-- | modules/simpletest/simpletest.module | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/database_test.test | 24 |
3 files changed, 14 insertions, 14 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 1c1060de5..6d1086bef 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -819,7 +819,7 @@ class DrupalWebTestCase { $clean_url_original = variable_get('clean_url', 0); // Generate temporary prefixed database to ensure that tests have a clean starting point. - $db_prefix = Database::getActiveConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); + $db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); include_once DRUPAL_ROOT . '/includes/install.inc'; drupal_install_system(); diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index 4054696c4..39c08fecb 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -522,7 +522,7 @@ function simpletest_clean_environment() { * Removed prefixed tables from the database that are left over from crashed tests. */ function simpletest_clean_database() { - $tables = db_find_tables(Database::getActiveConnection()->prefixTables('{simpletest}') . '%'); + $tables = db_find_tables(Database::getConnection()->prefixTables('{simpletest}') . '%'); $schema = drupal_get_schema_unprocessed('simpletest'); $ret = array(); foreach (array_diff_key($tables, $schema) as $table) { diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 589de9600..41d66cb7e 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -156,7 +156,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase { Database::addConnectionInfo('default', 'slave', $connection_info['default']); $db1 = Database::getConnection('default', 'default'); - $db2 = Database::getConnection('default', 'slave'); + $db2 = Database::getConnection('slave', 'default'); $this->assertNotNull($db1, t('default connection is a real connection object.')); $this->assertNotNull($db2, t('slave connection is a real connection object.')); @@ -164,18 +164,18 @@ class DatabaseConnectionTestCase extends DatabaseTestCase { // Try to open those targets another time, that should return the same objects. $db1b = Database::getConnection('default', 'default'); - $db2b = Database::getConnection('default', 'slave'); + $db2b = Database::getConnection('slave', 'default'); $this->assertIdentical($db1, $db1b, t('A second call to getConnection() returns the same object.')); $this->assertIdentical($db2, $db2b, t('A second call to getConnection() returns the same object.')); // Try to open an unknown target. $unknown_target = $this->randomName(); - $db3 = Database::getConnection('default', $unknown_target); + $db3 = Database::getConnection($unknown_target, 'default'); $this->assertNotNull($db3, t('Opening an unknown target returns a real connection object.')); $this->assertIdentical($db1, $db3, t('An unknown target opens the default connection.')); // Try to open that unknown target another time, that should return the same object. - $db3b = Database::getConnection('default', $unknown_target); + $db3b = Database::getConnection($unknown_target, 'default'); $this->assertIdentical($db3, $db3b, t('A second call to getConnection() returns the same object.')); } @@ -192,7 +192,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase { Database::ignoreTarget('default', 'slave'); $db1 = Database::getConnection('default', 'default'); - $db2 = Database::getConnection('default', 'slave'); + $db2 = Database::getConnection('slave', 'default'); $this->assertIdentical($db1, $db2, t('Both targets refer to the same connection.')); } @@ -2054,7 +2054,7 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase { $name = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 63))->fetchField(); if ($name == 'Elvis') { - if (!Database::getActiveConnection()->supportsTransactions()) { + if (!Database::getConnection()->supportsTransactions()) { // This is an expected fail. // Database engines that don't support transactions can leave partial // inserts in place when an error occurs. This is the case for MySQL @@ -2200,7 +2200,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase { * Whether or not to try rolling back the transaction when we're done. */ protected function transactionOuterLayer($suffix, $rollback = FALSE) { - $connection = Database::getActiveConnection(); + $connection = Database::getConnection(); $txn = db_transaction(); // Insert a single row into the testing table. @@ -2230,7 +2230,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase { * Whether or not to try rolling back the transaction when we're done. */ protected function transactionInnerLayer($suffix, $rollback = FALSE) { - $connection = Database::getActiveConnection(); + $connection = Database::getConnection(); // Start a transaction. If we're being called from ->transactionOuterLayer, // then we're already in a transaction. Normally, that would make starting @@ -2263,7 +2263,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase { */ function testTransactionsSupported() { try { - $connection = Database::getActiveConnection(); + $connection = Database::getConnection(); if ($connection->supportsTransactions()) { // Start a "required" transaction. This should fail if we do @@ -2284,7 +2284,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase { */ function testTransactionsNotSupported() { try { - $connection = Database::getActiveConnection(); + $connection = Database::getConnection(); if (!$connection->supportsTransactions()) { // Start a "required" transaction. This should fail if we do this @@ -2306,7 +2306,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase { */ function testTransactionRollBackSupported() { // This test won't work right if transactions are not supported. - if (!Database::getActiveConnection()->supportsTransactions()) { + if (!Database::getConnection()->supportsTransactions()) { return; } try { @@ -2332,7 +2332,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase { */ function testTransactionRollBackNotSupported() { // This test won't work right if transactions are supported. - if (Database::getActiveConnection()->supportsTransactions()) { + if (Database::getConnection()->supportsTransactions()) { return; } try { |