Skip to content

Commit ac10883

Browse files
committed
Close connections on teardown
1 parent b9c3c5d commit ac10883

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

Tests/DatabaseMysqlCase.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ public static function setUpBeforeClass()
8888
}
8989
}
9090

91+
/**
92+
* This method is called after the last test of this test class is run.
93+
*
94+
* @return void
95+
*
96+
* @since 1.0
97+
*/
98+
public static function tearDownAfterClass()
99+
{
100+
if (static::$driver !== null)
101+
{
102+
static::$driver->disconnect();
103+
static::$driver = null;
104+
}
105+
}
106+
91107
/**
92108
* Gets the data set to be loaded into the database during setup
93109
*

Tests/DatabaseMysqliCase.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ public static function setUpBeforeClass()
8585
}
8686
}
8787

88+
/**
89+
* This method is called after the last test of this test class is run.
90+
*
91+
* @return void
92+
*
93+
* @since 1.0
94+
*/
95+
public static function tearDownAfterClass()
96+
{
97+
if (static::$driver !== null)
98+
{
99+
static::$driver->disconnect();
100+
static::$driver = null;
101+
}
102+
}
103+
88104
/**
89105
* Gets the data set to be loaded into the database during setup
90106
*

Tests/DatabaseOracleCase.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ public static function setUpBeforeClass()
9898
}
9999
}
100100

101+
/**
102+
* This method is called after the last test of this test class is run.
103+
*
104+
* @return void
105+
*
106+
* @since 1.0
107+
*/
108+
public static function tearDownAfterClass()
109+
{
110+
if (static::$driver !== null)
111+
{
112+
static::$driver->disconnect();
113+
static::$driver = null;
114+
}
115+
}
116+
101117
/**
102118
* Gets the data set to be loaded into the database during setup
103119
*

Tests/DatabasePgsqlCase.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ public static function setUpBeforeClass()
8888
}
8989
}
9090

91+
/**
92+
* This method is called after the last test of this test class is run.
93+
*
94+
* @return void
95+
*
96+
* @since 1.0
97+
*/
98+
public static function tearDownAfterClass()
99+
{
100+
if (static::$driver !== null)
101+
{
102+
static::$driver->disconnect();
103+
static::$driver = null;
104+
}
105+
}
106+
91107
/**
92108
* Gets the data set to be loaded into the database during setup
93109
*

Tests/DatabasePostgresqlCase.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ public static function setUpBeforeClass()
8888
}
8989
}
9090

91+
/**
92+
* This method is called after the last test of this test class is run.
93+
*
94+
* @return void
95+
*
96+
* @since 1.0
97+
*/
98+
public static function tearDownAfterClass()
99+
{
100+
if (static::$driver !== null)
101+
{
102+
static::$driver->disconnect();
103+
static::$driver = null;
104+
}
105+
}
106+
91107
/**
92108
* Gets the data set to be loaded into the database during setup
93109
*

Tests/DatabaseSqlsrvCase.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ public static function setUpBeforeClass()
9191
}
9292
}
9393

94+
/**
95+
* This method is called after the last test of this test class is run.
96+
*
97+
* @return void
98+
*
99+
* @since 1.0
100+
*/
101+
public static function tearDownAfterClass()
102+
{
103+
if (static::$driver !== null)
104+
{
105+
static::$driver->disconnect();
106+
static::$driver = null;
107+
}
108+
}
109+
94110
/**
95111
* Gets the data set to be loaded into the database during setup
96112
*

0 commit comments

Comments
 (0)