fix(tests): isolate databases in memory and reject persistent connections

This commit is contained in:
2026-09-14 12:35:34 -03:00
parent 28ab6c9ae4
commit 289ceba3af
8 changed files with 177 additions and 14 deletions

16
tests/bootstrap.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
// Set every environment source before Laravel or Dotenv can read the local .env.
foreach ([
'APP_ENV' => 'testing',
'DB_CONNECTION' => 'sqlite',
'DB_DATABASE' => ':memory:',
'DB_URL' => 'null',
'APP_CONFIG_CACHE' => __DIR__.'/../bootstrap/cache/phpunit-config.php',
] as $key => $value) {
putenv($key.'='.$value);
$_ENV[$key] = $value;
$_SERVER[$key] = $value;
}
require __DIR__.'/../vendor/autoload.php';