[10.x] Fix parallel testing without any database connection #47705
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running Parallel Testing, one of the checks that happens within the framework is whether we're using SQLite or not. However, this check is done via
DB::getConfig()
. What truly happens here is:database.default
.getConfig()
returns:memory:
is performed.As we can see, even if we specify
without-databases
, the ParallelTesting class is still establishing a database connection.The added test goes to show that if we create a Laravel Application and delete the
database.default
configuration in our project skeleton, thenphp artisan test --parallel --without-databases
will still crash because it cannot establish a database connection to check if it's SQLite or not.The code change partially mitigates the problem. I think a deeper issue is the fact that a complete database connection is being established just to check whether the developer is using SQLite or not. However, for the sake of simplicity and brevity, we can at least use the
without-databases
flag to decide to not even try connecting to any database.