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
@@ -172,6 +172,24 @@ function warehouseCommand($test, $actor, string $action, array $extra = []): arr
return $input;
}
test('production delivery preserves its original reference and uses one native stock issue and print document', function (string $reference) {
$data = $this->draftData;
$data['operation_key'] = (string) Str::uuid();
$data['lines'][0] = [...$data['lines'][0], 'use' => 'production', 'production_reference' => $reference];
$this->r = app(WarehouseRequests::class)->draft($this->f['issuer'], $data);
warehouseCommand($this, $this->f['issuer'], 'submit');
warehouseCommand($this, $this->reviewer, 'authorize');
$input = warehouseCommand($this, $this->f['receiver'], 'deliver', ['lines' => [['index' => 0, 'quantity' => '4.000']]]);
$this->postJson('/stock/requisicoes/'.$this->r->id.'/eventos', $input)->assertRedirect();
$delivery = WarehouseRequestEvent::query()->where('warehouse_request_id', $this->r->id)->where('action', 'deliver')->sole();
expect($delivery->data['lines'][0]['production']['reference'])->toBe($reference)
->and(DB::table('stock_operations')->where('kind', 'issue')->count())->toBe(1)
->and(app(StockWorkflow::class)->balance($this->f['stock']->id, $this->f['warehouse']->id)['quantity'])->toBe(6000);
$this->get('/stock/requisicoes/'.$this->r->id.'/entregas/'.$delivery->id.'/imprimir')->assertOk()->assertSee('Insumos para produção')->assertSee('Referência declarada: '.$reference);
$this->get('/stock/requisicoes.csv')->assertOk();
expect($this->get('/stock/requisicoes.csv')->streamedContent())->toContain('Referência declarada: '.$reference);
})->with(['OP-QA-001', '0']);
test('internal request is the exit document and partial deliveries consume only actual quantities with independent receipt', function () {
warehouseCommand($this, $this->f['issuer'], 'submit', ['partial_allowed' => true]);
warehouseCommand($this, $this->reviewer, 'authorize', ['partial_allowed' => true]);