Unit testing failing on multiple database connection #50196
Unanswered
shahakshay938
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.
-
Laravel Version
10.45.1
PHP Version
8.1.27
Database Driver & Version
mysql Ver 8.2.0 for macos14.0 on arm64 (Homebrew)
Description
I've set up two MySQL database connections and added test cases, but now it's failing because another database connection (the secondary database) was not refreshed by the 'RefreshDatabase' trait.
How I resolved it
Created and used this new trait "RefreshTestDatabase" instead of laravel default "RefreshDatabase" and added this code
`
<?php
`
Steps To Reproduce
Beta Was this translation helpful? Give feedback.
All reactions