mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Merge pull request #54 from open-sausages/pulls/2.0/i-am-getenv-us-of-your-progress
Fix update getenv call
This commit is contained in:
commit
03a1311bef
@ -5,6 +5,7 @@ namespace SilverStripe\TestSession;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
|
use SilverStripe\Core\Environment;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Core\Config\Configurable;
|
use SilverStripe\Core\Config\Configurable;
|
||||||
@ -250,7 +251,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 = getenv('SS_DATABASE_PREFIX') ?: 'ss_';
|
$prefix = Environment::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");
|
||||||
|
Loading…
Reference in New Issue
Block a user