Merge pull request #30 from jeffreyguo/pulls/cleanup-temp-db

clean up team db after test session run
This commit is contained in:
Daniel Hensby 2016-01-21 22:35:21 +00:00
commit ac8492b546
1 changed files with 9 additions and 0 deletions

View File

@ -362,6 +362,15 @@ class TestSessionEnvironment extends Object
$this->extend('onBeforeEndTestSession');
if (SapphireTest::using_temp_db()) {
$state = $this->getState();
$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);