PHPUnit Testing - RefreshDatabase has different behavior when using :memory: #32907
Unanswered
indykoning
asked this question in
General
Replies: 2 comments
-
could you post your setUp() method? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Of course, it is quite a simple one:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The RefreshDatabase behaves differently when using databases other than
:memory:
When an in memory database is used it will be cleared out before every function that is ran in a test file.
However if a database other than
:memory:
is used it's behavior changes to only clearing out the database before executing a file.I have a seeder running on
setUp()
this works perfectly with the:memory:
database, however it completely breaks when using any other database since old data has not been removed.This could also breaks tests since they are build to be ran in a new database instead of one that has already been changed by previous tests.
What is the reason behind the different behavior, and is there a good way to make the tests behave the same way as
:memory:
databases in other databases?Beta Was this translation helpful? Give feedback.
All reactions