commit de compras
This commit is contained in:
@@ -11,6 +11,14 @@ final class TestingDatabaseGuard
|
||||
{
|
||||
$name = $connection ?: config('database.default');
|
||||
$config = config("database.connections.{$name}", []);
|
||||
if(app()->environment(['testing','browser-testing'])&&(config('sales_ledger.synthetic_enabled')===true||config('cost_ledger.synthetic_enabled')===true||config('industrial_ledger.synthetic_enabled')===true)
|
||||
&&($config['driver']??null)==='pgsql'&&($config['host']??null)==='127.0.0.1'&&(string)($config['port']??'')==='55439'
|
||||
&&preg_match('/^payable_sgf_([a-f0-9]{12})$/D',$config['database']??'',$m)&&($config['username']??null)==='payable_history_sgf_'.$m[1]
|
||||
&&empty($config['url'])&&empty($config['read'])&&empty($config['write'])&&($config['search_path']??'public')==='public'){
|
||||
\Tempo\Finance\GeneralLedger\LedgerSchema::assertSynthetic(DB::connection($name));
|
||||
$actual=DB::connection($name)->selectOne('SELECT current_database() db,current_user role');
|
||||
if($actual->db!==$config['database']||$actual->role!==$config['username'])throw new RuntimeException('SGF_TEST_DATABASE_REFUSED: configuração QA e destino efectivo divergem.');return;
|
||||
}
|
||||
$expected = [
|
||||
'driver' => 'pgsql', 'host' => '127.0.0.1', 'port' => '55432',
|
||||
'database' => 'sgf_tempo_test', 'username' => 'sgf_test_runner',
|
||||
|
||||
Reference in New Issue
Block a user