Skip to content

Commit 8053498

Browse files
committed
resetting connection in setUpBeforeClass
1 parent a715525 commit 8053498

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Tests/PersistUnit/ModelTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ protected static function getCaches(){
5151
}
5252

5353
public static function setUpBeforeClass(){
54+
// close connections if any
55+
$reflectionProperty = new \ReflectionProperty('PhpPlatform\Persist\Connection\ConnectionFactory', 'connection');
56+
$reflectionProperty->setAccessible(true);
57+
$conection = $reflectionProperty->getValue(null);
58+
if($conection != null){
59+
$conection->close();
60+
$reflectionProperty->setValue(null,null);
61+
}
62+
5463
self::$_databaseName = "db".preg_replace('/[^0-9]/', '', microtime());
5564

5665
// get connection parameters

0 commit comments

Comments
 (0)