Unit testig on multisite

by alexej_d   Last Updated December 20, 2017 12:07 PM

I am trying to simulate a multi-site environment in an integration test with phpunit. I know how to init a new database connection with Database::addConnectionInfo but how can I cleanly switch the database used by the current environment?

Database::setActiveConnection will only work for SQL queries but I would like to use the entity_type.manager service and the only way I found is to replace the database service in the container and call KernelTest::setUp. Switching back an forth between the databases is still pretty buggy and complex.

Any ideas?

Related Questions

AWS RDS and Multiple Database Installation

Updated April 21, 2015 21:03 PM

PDOException: SQLSTATE[HY000] [2002]

Updated June 15, 2016 08:03 AM