[ 'type' => 'sqlite', 'host' => 'localhost', 'name' => ':memory:', 'user' => '', 'pass' => '', ], 'mysql' => [ 'type' => 'mysql', 'host' => '127.0.0.1', 'name' => 'duckbrain_test', 'user' => 'duckbrain', 'pass' => 'duckbrain', ], 'pgsql' => [ 'type' => 'pgsql', 'host' => '127.0.0.1', 'name' => 'duckbrain_test', 'user' => 'duckbrain', 'pass' => 'duckbrain', ], ]; if (!isset($profiles[$engine])) { fwrite( STDERR, "Invalid DUCKBRAIN_TEST_DB '{$engine}'. Expected one of: " . implode(', ', array_keys($profiles)) . "\n" ); exit(1); } // Define DB constants BEFORE config.php so the test database wins over the // real configuration (config.php's define() warnings are suppressed by @). // Each field can be overridden without losing the engine's other defaults. $profile = $profiles[$engine]; define('DB_TYPE', $profile['type']); define('DB_HOST', getenv('DUCKBRAIN_TEST_HOST') ?: $profile['host']); define('DB_NAME', getenv('DUCKBRAIN_TEST_NAME') ?: $profile['name']); define('DB_USER', getenv('DUCKBRAIN_TEST_USER') ?: $profile['user']); define('DB_PASS', getenv('DUCKBRAIN_TEST_PASS') ?: $profile['pass']); @require_once __DIR__ . '/../autoload.php';