function prepareTestDatabaseConfig(Config $config) { $testDb = $config->database_tests; Factory::setTest(true); if ('@USERNAME@' !== $testDb['username']) { return; // testDb is already configured, we do not want to overwrite any existing settings. } $db = $config->database; $testDb['username'] = $db['username']; if (empty($testDb['password'])) { $testDb['password'] = $db['password']; } if (empty($testDb['host'])) { $testDb['host'] = $db['host']; } $testDb['tables_prefix'] = ''; // tables_prefix has to be empty for UI tests $config->database_tests = $testDb; $config->forceSave(); }