-3

How to copy production database to test environment? I would like to test my website functionally, but for that I need the current database. I do not want to flip the database through phpmyadmin or temporarily change parameters, just after running the phpunit command, I want it to happen automatically.

In app/config/config_test.yml I have set up my test database.

But maybe this should not be tested? How do you deal with functional testing with testing things that depend on the database?

soweno
  • 1
  • 1

1 Answers1

0

Using your prod db for testing is generally not a good idea, why? because it's state will be different every time you run your tests.

The most common approach is to have the same db schema as you have in production (minus the migrations that might have not yet been deployed), and then use fixtures for each functional test, that way you start your tests with your db in a known state.

gvf
  • 1,039
  • 7
  • 6