BernardoBF4's avatar

Set database for testing

I am currently trying to run a test and I get the error SQLSTATE[HY000] [2002] Connection refused. I have not changed any configuration in my config/database.php or phpunit.xml. I believe that the main point here is to decide the best strategy for TDD.

I want to use mysql and not sqlite, because I believe that having the real environment an advantage, but I don't know if can use it in memory, if I should create another container for a new database, or use the "official" database and container. Either way I believe I am going to get the same error again, but helping me decide the strategy to take is a fine too.

0 likes
2 replies
Sinnbeck's avatar

Personally I just added an extra database in my mysql container called testing and used that. I just overwrite the database name in phpunit.xml

This is of course locally

1 like

Please or to participate in this conversation.