Skip to content

Commit

Permalink
FIX Ensure primary connection is updated with temporary database
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 18, 2024
1 parent 097313b commit d670ff1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/TestSessionEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ public function connectToDatabase($state = null)
$this->oldDatabaseName = $databaseConfig['database'];
$databaseConfig['database'] = $state->database;
DB::connect($databaseConfig);
// This is required for CMS 5.4+
if (method_exists(DB::class, 'hasConfig') && DB::hasConfig('primary')) {
DB::connect($databaseConfig, 'primary');
}
}
}
}
Expand Down

0 comments on commit d670ff1

Please sign in to comment.