diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-04 05:36:57 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-04 05:36:57 +0000 |
commit | 4e614ace820166d83b4767983404f79b2ba44949 (patch) | |
tree | 5ff3b3c40c308de0b1cc2c869cecfe6271662222 /modules/simpletest/tests/database_test.test | |
parent | b405e61329ba3d48602c9d24d641a8f4e099ef09 (diff) | |
download | brdo-4e614ace820166d83b4767983404f79b2ba44949.tar.gz brdo-4e614ace820166d83b4767983404f79b2ba44949.tar.bz2 |
#434350 by cpliakas and Crell: Add a method to explicitly close a database connection.
Diffstat (limited to 'modules/simpletest/tests/database_test.test')
-rw-r--r-- | modules/simpletest/tests/database_test.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index c354e9a8e..6b5eb2d0b 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -230,6 +230,21 @@ class DatabaseConnectionTestCase extends DatabaseTestCase { $this->assertIdentical($db1, $db2, t('Both targets refer to the same connection.')); } + + /** + * Tests the closing of a database connection. + */ + function testConnectionClosing() { + // Open the default target so we have an object to compare. + $db1 = Database::getConnection('default', 'default'); + + // Try to close the the default connection, then open a new one. + Database::closeConnection('default', 'default'); + $db2 = Database::getConnection('default', 'default'); + + // Opening a connection after closing it should yield an object different than the original. + $this->assertNotIdentical($db1, $db2, t('Opening the default connection after it is closed returns a new object.')); + } } /** |