commit melhorias compras4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-22 16:28:03 +02:00
parent efd97e265b
commit 36dcfdf00c
118 changed files with 6042 additions and 92 deletions
@@ -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();