diff options
| author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-06-06 19:32:59 -0500 |
|---|---|---|
| committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-06-06 19:32:59 -0500 |
| commit | f1d00fa6476e600e662f72046cf706311edb9a49 (patch) | |
| tree | c8c451183ef34379343c2580b7c49d54b8b6a506 /tests/test_framework/phpbb_database_test_case.php | |
| parent | efaed6386f212e37be23aae396496fd75c6a7424 (diff) | |
| parent | a7e3a1b3760ddd7aeb2208bebe89283534d62790 (diff) | |
| download | forums-f1d00fa6476e600e662f72046cf706311edb9a49.tar forums-f1d00fa6476e600e662f72046cf706311edb9a49.tar.gz forums-f1d00fa6476e600e662f72046cf706311edb9a49.tar.bz2 forums-f1d00fa6476e600e662f72046cf706311edb9a49.tar.xz forums-f1d00fa6476e600e662f72046cf706311edb9a49.zip | |
Merge remote-tracking branch 'remotes/upstream/develop-olympus' into develop
# By Joas Schilling
# Via Joas Schilling (1) and Nils Adermann (1)
* remotes/upstream/develop-olympus:
[ticket/11590] Close database connections when tearDown() is called
Diffstat (limited to 'tests/test_framework/phpbb_database_test_case.php')
| -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 72bce2e38a..c11537b047 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() @@ -121,6 +139,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $db = new $config['dbms'](); $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); + $this->db_connections[] = $db; + return $db; } |
