Skip to content

[2.x] fix(testing): Run after-commit callbacks inline in integration tests - #4833

Merged
imorland merged 1 commit into
2.xfrom
im/after-commit-tests
Jul 24, 2026
Merged

[2.x] fix(testing): Run after-commit callbacks inline in integration tests#4833
imorland merged 1 commit into
2.xfrom
im/after-commit-tests

Conversation

@imorland

Copy link
Copy Markdown
Member

Fixes #4814.

Binding db.transactions (#4787) means listeners implementing ShouldHandleEventsAfterCommit — and events implementing ShouldDispatchAfterCommit, and any direct Connection::afterCommit() callback — are deferred to the surrounding transaction's commit. The integration harness wraps each test in a transaction that is rolled back and never committed, so those callbacks were attached to it and silently discarded. After-commit behaviour therefore could not be observed or asserted in integration tests, with no error.

The test harness now binds a DatabaseTransactionsManager subclass (InlineTransactionsManager) that reports no applicable pending transactions, so addCallback() runs each callback immediately instead of deferring it. db.transactions stays bound and attached to the connection, so Connection::afterCommit() still works and #4787 stays intact — AfterCommitTest continues to pass.

The manager is bound and attached to the connection via a BindInlineTransactionsManager extender that runs before the harness opens its transaction.

Covered by integration tests for all three paths: a direct afterCommit() callback, a ShouldHandleEventsAfterCommit listener, and a ShouldDispatchAfterCommit event.

Binding db.transactions (#4787) means listeners implementing
ShouldHandleEventsAfterCommit are deferred to the surrounding
transaction's commit. The integration harness wraps each test in a
transaction that is rolled back and never committed, so those callbacks
were attached to it and silently discarded — after-commit behaviour
could not be tested (#4814).

Bind a DatabaseTransactionsManager subclass in the test harness that
reports no applicable pending transactions, so addCallback() runs each
callback immediately. db.transactions stays bound and
Connection::afterCommit() still works, keeping #4787 intact.

Refs #4814
@imorland
imorland requested a review from a team as a code owner July 24, 2026 14:00
@imorland imorland changed the title Run after-commit callbacks inline in integration tests [2.x] Run after-commit callbacks inline in integration tests Jul 24, 2026
@imorland imorland added this to the 2.0.0-rc.6 milestone Jul 24, 2026
@imorland imorland changed the title [2.x] Run after-commit callbacks inline in integration tests [2.x] fix(testing): Run after-commit callbacks inline in integration tests Jul 24, 2026
@imorland
imorland merged commit bd308fe into 2.x Jul 24, 2026
25 checks passed
@imorland
imorland deleted the im/after-commit-tests branch July 24, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] ShouldHandleEventsAfterCommit listeners silently never run in integration tests

1 participant