Skip to content

Conversation

@outdooracorn
Copy link
Member

@outdooracorn outdooracorn commented Jan 27, 2026

Cleaning up from tests with User::query()->delete(); has the negative side effect of deleting all users, rather than just the ones created in CheckUserEmailExistTest.

Use Laravel's DatabaseTransactions trait instead that wraps each test case in a database transaction and only reverts database modifications caused by the test.

Bug: T415636

Copy link
Contributor

@deer-wmde deer-wmde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah great spot, thanks!

I think it now just needs a rebase because I just merged the PR that adds a comment here #1044

Cleaning up from tests with `User::query()->delete();` is a bad idea as it will delete all users rather than just the ones created in `CheckUserEmailExistTest`.

Use Laravel's `DatabaseTransactions` trait instead that wraps each test case in a database transaction and only reverts database modifications cause by the test.

Bug: T415636
@outdooracorn outdooracorn force-pushed the use-database-transactions-trait branch from bbf30bc to 26563fa Compare January 27, 2026 10:56
@outdooracorn outdooracorn merged commit 85b46f9 into main Jan 27, 2026
5 checks passed
@outdooracorn outdooracorn deleted the use-database-transactions-trait branch January 27, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants