-
Hi, I was previously using factories with random data to create my tests, however I hit a brick wall when trying to test with real data in the main database. At first I thought that Datasets was the cure, but after testing, it isn't what I needed. I dont need to test each row, I want to mimic my main database by adding real data before each test. The problem is that the seed works, but adds it to the main database and not the test database (in memory). My Test
My phpunit.xml
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
cc @lukeraymonddowning Do you see the reason? 🤔 |
Beta Was this translation helpful? Give feedback.
-
I added this to my test It was showing my main connection, so this makes sense. After googling this there is an artisan command called config:clear. I ran the command and tried again. It was showing my main connection again. How I fixed it in the end
Issue solved for now, looks like the caching was causing issues. I don't know if its a Laravel issue or Valet issue. |
Beta Was this translation helpful? Give feedback.
I added this to my test
ray(env('APP_ENV'), env('DB_CONNECTION'), env('DB_DATABASE'));
It was showing my main connection, so this makes sense. After googling this there is an artisan command called config:clear. I ran the command and tried again. It was showing my main connection again.
How I fixed it in the end
Issue solved for now, looks like the caching was causing issues. I don't know if its a Laravel issue or Valet issue.