Update references to deprecated global

This commit is contained in:
Damian Mooyman 2017-06-22 15:15:17 +12:00
parent f5ef9f4fbf
commit 2868e6bd3e
3 changed files with 17 additions and 17 deletions

View File

@ -10,9 +10,9 @@ TestSessionEnvironment::singleton()->loadFromFile();
* This closure will run every time a Resque_Event is forked (just before it is forked, so it applies to the parent
* and child process).
*/
if(class_exists('Resque_Event') && class_exists('SSResqueRun')) {
Resque_Event::listen('beforeFork', function($data) {
global $databaseConfig;
if (class_exists('Resque_Event') && class_exists('SSResqueRun')) {
Resque_Event::listen('beforeFork', function ($data) {
$databaseConfig = DB::getConfig();
// Reconnect to the database - this may connect to the old DB first, but is required because these processes
// are long-lived, and MySQL connections often get closed in between worker runs. We need to connect before
@ -21,7 +21,7 @@ if(class_exists('Resque_Event') && class_exists('SSResqueRun')) {
$testEnv = TestSessionEnvironment::singleton();
if($testEnv->isRunningTests()) {
if ($testEnv->isRunningTests()) {
$testEnv->loadFromFile();
} else {
$testEnv->endTestSession();

View File

@ -450,9 +450,9 @@ class TestSessionEnvironment
public function resetDatabaseName()
{
if ($this->oldDatabaseName) {
global $databaseConfig;
$databaseConfig = DB::getConfig();
$databaseConfig['database'] = $this->oldDatabaseName;
DB::setConfig($databaseConfig);
$conn = DB::get_conn();

View File

@ -58,7 +58,7 @@ class TestSessionRequestFilter implements RequestFilter
$file = $testState->stubfile;
if (!Director::isLive() && $file && file_exists($file)) {
// Connect to the database so the included code can interact with it
global $databaseConfig;
$databaseConfig = DB::getConfig();
if ($databaseConfig) {
DB::connect($databaseConfig);
}