commit compras1 2911
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-29 05:28:30 +02:00
parent 1ddabbbdcc
commit 448948a487
137 changed files with 9481 additions and 1926 deletions
+24 -1
View File
@@ -340,11 +340,33 @@ test('a partial native order retains its confirmed imported item classification
->and(StockMovement::query()->count())->toBe(1)->and((int) StockMovement::query()->sum('quantity_milli'))->toBe(400);
});
test('ordinary controlled order preserves the common budget confirmation and its original on replay', function () {
$adapter = app(CommonBudget::class);
$this->actingAs($this->finance);
$id = $adapter->for($this->finance)->create(['cost_center_id' => $this->r->cost_center_id, 'year' => (int) now()->year,
'kind' => 'operating', 'includes_tax' => true, 'amount_minor' => 20000, 'reason' => 'Dotação exclusivamente sintética para conferir o documento de emissão.']);
$this->actingAs($this->admin);
$adapter->for($this->admin)->approve($id);
$this->actingAs($this->finance);
DB::transaction(fn () => app(BudgetWorkflow::class)->record($this->finance, $this->r, 'reserve', 10000, 10000));
$this->actingAs($this->buyer);
$award = selectPurchaseAward($this);
$order = issuePurchaseOrder($this, $award);
expect($order->snapshot['budget_checked'])->toBeTrue()->and($order->snapshot['budget_control']['budget_id'])->toBe($id);
$original = $order->snapshot;
$entries = DB::table('budget_entries')->count();
$this->post('/adjudicacoes/'.$award->id.'/emitir')->assertRedirect();
expect($order->fresh()->snapshot)->toBe($original)->and(DB::table('budget_entries')->count())->toBe($entries);
$this->get('/ordens/'.$order->id.'/imprimir')->assertOk()->assertSee('Controlo orçamental registado na emissão.');
});
test('distributed approved synthetic requisition follows native adjudication approval and issuance without parallel entries', function () {
if (! method_exists(BudgetControl::class, 'recordDistribution')) {
$this->markTestSkipped('Unpublished common source requires explicit QA selection.');
}
budgetDistributionFixtureSchema();
if (! DB::getSchemaBuilder()->hasTable('budget_distributions')) {
budgetDistributionFixtureSchema();
}
config(['budget-distributions.qa_enabled' => true]);
$this->withoutVite();
$second = CostCenter::query()->create(['tenant_id' => $this->tenant->id, 'department_id' => $this->department->id, 'code' => 'QA-SPLIT', 'name' => 'Segundo centro sintético']);
@@ -370,6 +392,7 @@ test('distributed approved synthetic requisition follows native adjudication app
$award = selectPurchaseAward($this);
$order = issuePurchaseOrder($this, $award);
expect($order->snapshot['budget_control']['phase'])->toBe('commit')
->and($order->snapshot['budget_checked'])->toBeTrue()
->and(DB::table('budget_distribution_entries')->where('kind', 'commit')->count())->toBe(2)
->and(DB::table('budget_entries')->where('requisition_id', $this->r->id)->count())->toBe(0);
$before = DB::table('budget_distribution_entries')->count();