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

This commit is contained in:
2026-11-22 10:56:58 +02:00
parent 4fac443dda
commit efd97e265b
130 changed files with 8917 additions and 363 deletions
+18
View File
@@ -52,6 +52,24 @@ test('equipment destination is conditional and selected from the permitted catal
$this->postJson('/stock/requisicoes', $this->data)->assertUnprocessable();
});
test('production input destination freezes a declared reference without requiring an external production order or creating a purchase', function () {
$body = $this->data;
$body['lines'][0] = [...$body['lines'][0], 'use' => 'production', 'production_reference' => 'OP-QA-001'];
$purchases = DB::table('requisitions')->count();
$this->postJson('/stock/requisicoes', $body)->assertRedirect();
$this->postJson('/stock/requisicoes', $body)->assertRedirect();
$record = WarehouseRequest::query()->sole();
expect($record->snapshot['lines'][0]['production'])->toBe(['reference' => 'OP-QA-001', 'verification' => 'user_supplied'])
->and(DB::table('requisitions')->count())->toBe($purchases)->and(DB::table('stock_movements')->count())->toBe(0);
$body['operation_key'] = (string) Str::uuid();
$body['lines'][0]['production_reference'] = null;
$this->postJson('/stock/requisicoes', $body)->assertRedirect();
$body['operation_key'] = (string) Str::uuid();
$body['lines'][0]['use'] = 'internal';
$body['lines'][0]['production_reference'] = 'OP-QA-002';
$this->postJson('/stock/requisicoes', $body)->assertUnprocessable();
});
test('warehouse draft rejects another company sources and revoked access', function () {
$foreign = receiptFixture();
$this->actingAs($this->f['issuer'])->postJson('/stock/requisicoes', [...$this->data, 'warehouse_id' => $foreign['warehouse']->id])->assertNotFound();