commit12
This commit is contained in:
@@ -8,7 +8,22 @@ abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
if (in_array(\Illuminate\Foundation\Testing\RefreshDatabase::class, class_uses_recursive(static::class), true)
|
||||
&& !preg_match('/^[a-f0-9]{12}$/D', (string)getenv('SGF_ISOLATED_REGRESSION_RUN'))) {
|
||||
throw new \RuntimeException('SGF_DESTRUCTIVE_SUITE_REFUSED: use scripts/modular-regression-run.mjs; preserve the persistent demonstration.');
|
||||
}
|
||||
parent::setUp();
|
||||
\App\Shared\Testing\TestingDatabaseGuard::assertSafe();
|
||||
}
|
||||
|
||||
protected function setUpTraits()
|
||||
{
|
||||
// Called after application boot, before RefreshDatabase can issue DDL.
|
||||
if ($run=getenv('SGF_ISOLATED_REGRESSION_RUN')) {
|
||||
\App\Shared\Testing\TestingDatabaseGuard::assertSafe();
|
||||
$cluster=\Illuminate\Support\Facades\DB::selectOne("SELECT current_setting('cluster_name') AS name")->name;
|
||||
if ($cluster!=='sgf_modular_regression_'.$run) throw new \RuntimeException('SGF_DESTRUCTIVE_SUITE_REFUSED: unexpected cluster identity.');
|
||||
}
|
||||
return parent::setUpTraits();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user