Skip to content

Commit

Permalink
[10.x] Fix DB::afterCommit() broken in tests using DatabaseTransactio…
Browse files Browse the repository at this point in the history
…ns (#50068)

* Add failing test case for test database transactions manager

* Fix transaction commit in test causing all callbacks to execute in transaction
  • Loading branch information
oprypkhantc authored Feb 13, 2024
1 parent 616b6f1 commit 0b851fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DatabaseTransactionsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public function commit($connection, $levelBeingCommitted, $newTransactionLevel)
// shouldn't be any pending transactions, but going to clear them here anyways just
// in case. This method could be refactored to receive a level in the future too.
$this->pendingTransactions = $this->pendingTransactions->reject(
fn ($transaction) => $transaction->connection === $connection
fn ($transaction) => $transaction->connection === $connection &&
$transaction->level >= $levelBeingCommitted
)->values();

[$forThisConnection, $forOtherConnections] = $this->committedTransactions->partition(
Expand Down

0 comments on commit 0b851fc

Please sign in to comment.