Replies: 3 comments 8 replies
-
I've never used |
Beta Was this translation helpful? Give feedback.
-
Hi, I have discovered an issue that may be related to context discussed.
I expected the following result:
However, I actually got the following result:
From this result, it appears that the Application instance increment each time the test method is executed, and is never destroyed until the end. edit) It looks like it has been cleaned up because Therefore, rather than saying that the connection remains because the Application instance remains, my opinion is that there seems to be a hidden place somewhere where the instance reference is still retained. |
Beta Was this translation helpful? Give feedback.
-
Overview
In recent discussions and PRs, we've encountered challenges with handling database connections in tests, particularly when using
DatabaseTruncation
orDatabaseMigrations
. The core issue revolves around ensuring that database connections are properly closed after tests, without causing unintended side effects in the test teardown process. This poll seeks community input on the best approach to address this issue.Options
Implement Disconnection in
tearDown()
Re-attempt the fix by disconnecting the database connection in the
tearDown()
method and propose it again for the 11.x branch. It's important to adhere to the proper call order ofparent::tearDown()
, as not doing so led to the issue raised in:Use
beforeApplicationDestroyed()
insetUp()
Propose the fix by utilizing
beforeApplicationDestroyed()
within thesetUp()
method and re-submit for the 11.x branch. This might have broader implications due to compatibility issues withorchestra/testbench
. As explained by @KentarouTakeda in:Update Documentation and Delegate to Users
Amend comments in
DatabaseTruncation
andDatabaseMigrations
and update the official documentation to guide users to handle this issue on their end. This approach avoids changes to the framework itself and places the responsibility on the users.Other
Please specify any alternative suggestions or insights.
8 votes ·
Beta Was this translation helpful? Give feedback.
All reactions