Skip to content

Commit

Permalink
Terminate user defined database connections after rollback during tes…
Browse files Browse the repository at this point in the history
…ting while using the DatabaseTransactions trait. (#20340)
  • Loading branch information
twig1337 authored and taylorotwell committed Aug 2, 2017
1 parent 4fbf774 commit 17176b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Illuminate/Foundation/Testing/DatabaseTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public function beginDatabaseTransaction()

$this->beforeApplicationDestroyed(function () use ($database) {
foreach ($this->connectionsToTransact() as $name) {
$database->connection($name)->rollBack();
$connection = $database->connection($name);

$connection->rollBack();
$connection->disconnect();
}
});
}
Expand Down

0 comments on commit 17176b7

Please sign in to comment.