diff options
author | Nils Adermann <naderman@naderman.de> | 2013-06-06 16:49:22 -0700 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2013-06-06 16:49:22 -0700 |
commit | a7e3a1b3760ddd7aeb2208bebe89283534d62790 (patch) | |
tree | dd7bbda18d6e16c0f9acfc0db6323be90b07cff5 | |
parent | 6b6a07560eef269c7cebf2e6e97df3c070402554 (diff) | |
parent | 228c1075b765e8d51a997935bf12f973ae02264e (diff) | |
download | forums-a7e3a1b3760ddd7aeb2208bebe89283534d62790.tar forums-a7e3a1b3760ddd7aeb2208bebe89283534d62790.tar.gz forums-a7e3a1b3760ddd7aeb2208bebe89283534d62790.tar.bz2 forums-a7e3a1b3760ddd7aeb2208bebe89283534d62790.tar.xz forums-a7e3a1b3760ddd7aeb2208bebe89283534d62790.zip |
Merge pull request #1466 from nickvergessen/ticket/11590
[ticket/11590] Close database connections when tearDown() is called
-rw-r--r-- | tests/test_framework/phpbb_database_test_case.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 429bb92bf1..beddece470 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -11,6 +11,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { static private $already_connected; + private $db_connections; + protected $test_case_helpers; protected $fixture_xml_data; @@ -28,6 +30,22 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test 'phpbb_database_test_case' => array('already_connected'), ); + + $this->db_connections = array(); + } + + protected function tearDown() + { + parent::tearDown(); + + // Close all database connections from this test + if (!empty($this->db_connections)) + { + foreach ($this->db_connections as $db) + { + $db->sql_close(); + } + } } protected function setUp() @@ -123,6 +141,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $db = new $dbal(); $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); + $this->db_connections[] = $db; + return $db; } |