@@ -39,7 +39,25 @@ beforeEach(function () {
|
||||
$this->actingAs($this->admin);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
if ($this->committedReportFixture ?? false) {
|
||||
if (! app()->environment('testing') || DB::getDriverName() !== 'pgsql' || ! preg_match('/^compras_receipts_test_[a-f0-9]{12}$/D', DB::connection()->getDatabaseName()) || DB::transactionLevel() !== 0) {
|
||||
throw new LogicException('Report fixture cleanup requires the disposable PostgreSQL database.');
|
||||
}
|
||||
DB::statement('DROP SCHEMA public CASCADE');
|
||||
DB::statement('CREATE SCHEMA public');
|
||||
}
|
||||
});
|
||||
|
||||
test('intelligence settings are independently configurable audited and scoped without rewriting processes', function () {
|
||||
if (DB::getDriverName() === 'pgsql') {
|
||||
// The real report opens its own read-only snapshot, outside the test wrapper.
|
||||
if (! app()->environment('testing') || ! preg_match('/^compras_receipts_test_[a-f0-9]{12}$/D', DB::connection()->getDatabaseName()) || DB::transactionLevel() !== 1) {
|
||||
throw new LogicException('Report fixtures require the disposable PostgreSQL test transaction.');
|
||||
}
|
||||
DB::commit();
|
||||
$this->committedReportFixture = true;
|
||||
}
|
||||
$before = $this->f['r']->fresh()->toArray();
|
||||
$body = ['version' => 1, 'procurement_brief' => false, 'people_brief' => true, 'reason' => 'Apresentar sínteses apenas no percurso de Pessoas.'];
|
||||
$this->postJson($this->base.'/intelligence', $body)->assertRedirect();
|
||||
|
||||
Reference in New Issue
Block a user