Skip to content

Commit

Permalink
re-refresh database if transaction has been committed (laravel#53997)
Browse files Browse the repository at this point in the history
  • Loading branch information
SjorsO authored Dec 26, 2024
1 parent f826d0f commit 8636996
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Testing/RefreshDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public function beginDatabaseTransaction()
$dispatcher = $connection->getEventDispatcher();

$connection->unsetEventDispatcher();

if (! $connection->getPdo()->inTransaction()) {
RefreshDatabaseState::$migrated = false;
}

$connection->rollBack();
$connection->setEventDispatcher($dispatcher);
$connection->disconnect();
Expand Down

0 comments on commit 8636996

Please sign in to comment.