Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Disconnecting the database connection after testing #49327

Merged
Merged
1 change: 0 additions & 1 deletion src/Illuminate/Foundation/Testing/DatabaseTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function beginDatabaseTransaction()
$connection->unsetEventDispatcher();
$connection->rollBack();
$connection->setEventDispatcher($dispatcher);
$connection->disconnect();
driesvints marked this conversation as resolved.
Show resolved Hide resolved
}
});
}
Expand Down
1 change: 0 additions & 1 deletion src/Illuminate/Foundation/Testing/RefreshDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public function beginDatabaseTransaction()
$connection->unsetEventDispatcher();
$connection->rollBack();
$connection->setEventDispatcher($dispatcher);
$connection->disconnect();
driesvints marked this conversation as resolved.
Show resolved Hide resolved
}
});
}
Expand Down
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Testing/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ protected function tearDown(): void

ParallelTesting::callTearDownTestCaseCallbacks($this);

$database = $this->app['db'];
driesvints marked this conversation as resolved.
Show resolved Hide resolved
foreach (array_keys($database->getConnections()) as $name) {
$database->purge($name);
}
driesvints marked this conversation as resolved.
Show resolved Hide resolved

$this->app->flush();

$this->app = null;
Expand Down