@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user