Merge pull request #51 from silverstripe/pulls/1/env-in-shined

Fix converted to getenv()
This commit is contained in:
Damian Mooyman 2017-06-27 12:58:16 +12:00 committed by GitHub
commit 81130c7025

View File

@ -249,7 +249,7 @@ class TestSessionEnvironment
$state->database = $dbName; // In case it's changed by the call to SapphireTest::create_temp_db(); $state->database = $dbName; // In case it's changed by the call to SapphireTest::create_temp_db();
// Set existing one, assumes it already has been created // Set existing one, assumes it already has been created
$prefix = defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : 'ss_'; $prefix = getenv('SS_DATABASE_PREFIX') ?: 'ss_';
$pattern = strtolower(sprintf('#^%stmpdb.*#', preg_quote($prefix, '#'))); $pattern = strtolower(sprintf('#^%stmpdb.*#', preg_quote($prefix, '#')));
if (!preg_match($pattern, $dbName)) { if (!preg_match($pattern, $dbName)) {
throw new InvalidArgumentException("Invalid database name format"); throw new InvalidArgumentException("Invalid database name format");