clean up team db after test session run

This commit is contained in:
Jeffrey Guo 2016-01-27 14:25:57 +13:00
parent b98bbbe276
commit a7e189720e
1 changed files with 8 additions and 0 deletions

View File

@ -343,6 +343,14 @@ class TestSessionEnvironment extends Object {
$this->extend('onBeforeEndTestSession');
if(SapphireTest::using_temp_db()) {
$dbConn = DB::getConn();
$dbExists = $dbConn->databaseExists($state->database);
if($dbExists) {
// Clean up temp database
$dbConn->dropDatabase();
file_put_contents('php://stdout', "Deleted temp database: $state->database" . PHP_EOL);
}
// End test session mode
$this->resetDatabaseName();
SapphireTest::set_is_running_test(false);