From 4e614ace820166d83b4767983404f79b2ba44949 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 4 Aug 2009 05:36:57 +0000 Subject: #434350 by cpliakas and Crell: Add a method to explicitly close a database connection. --- modules/simpletest/tests/database_test.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules/simpletest/tests/database_test.test') 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.')); + } } /** -- cgit v1.2.3