I need to run unit tests for a Symfony2 application against two different DB configurations, one using a MySQL database and the other using a SQLite database.
I currently choose the DB configuration to use when running unit tests by editing app/config/config_test.yml
. I either uncomment the MySQL-related db settings and comment-out the SQLite-related db settings or vice versa.
I'd like to not have to do this and to instead have two configuration files - perhaps app/config/config-test-mysql.yml
and app/config/config-test-sqlite.yml
- and choose the test environment from the command line when the tests are run.
Having looked at the default Symfony2 phpunit config in app/phpunit.xml.dist
and having looked at the bootstrap file that config utilises (app/bootstrap.php.cache
), I cannot determine how the environment defaults to test
when running unit tests.
How can I choose the environment to use when running unit tests?