Unable to add values to $databaseTraits in \Illuminate\Testing\Concerns\TestDatabases #38022
Unanswered
JakeBooher
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
We have some custom traits for handling database migrations and rollbacks for certain test classes. For example, we have one that persists the database throughout the entire class. This works fine in the normal single threaded test CLI, but once I get into parallel tests I have issues that seem to be from it using the default SQLite database instead of the one created for each thread. Adding this into
\Illuminate\Testing\Concerns\TestDatabases
resolves this. However, to do that I have to extendIlluminate\Foundation\Providers\FoundationServiceProvider
with the following:and then overwrite the entire
bootTestDatabase
method from\Illuminate\Testing\Concerns\TestDatabases
by doing this:Easiest way to solve this would probably be to call a
getDatabaseTraits()
method like I'm doing in my extension so it can be extended alone, but it may be nice to have it done some way that I don't have to extend two separate providers to get to that pointSteps To Reproduce:
Beta Was this translation helpful? Give feedback.
All reactions