@@ -12,6 +12,7 @@ use App\Services\WarehouseFulfilment;
|
||||
use App\Services\WarehouseRequests;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Tempo\Integration\WarehouseFeed;
|
||||
use Tempo\Integration\WarehouseInbox;
|
||||
|
||||
require_once __DIR__.'/../Support/ReceiptFixture.php';
|
||||
@@ -50,6 +51,17 @@ function exchangeDeliver($test, string $quantity = '1.500'): WarehouseRequestEve
|
||||
return exchangeCommand($test, $test->f['receiver'], 'deliver', ['lines' => [['index' => 0, 'quantity' => $quantity]]]);
|
||||
}
|
||||
|
||||
test('production consumption remains compatible with the unchanged v1 feed while preserving local production details', function () {
|
||||
$this->r = app(WarehouseRequests::class)->draft($this->f['issuer'], ['operation_key' => (string) Str::uuid(), 'warehouse_id' => $this->f['warehouse']->id, 'cost_center_id' => $this->f['r']->cost_center_id,
|
||||
'destination' => 'Linha de produção QA', 'reason' => 'Consumo sintético de insumos de produção.', 'priority' => 'normal',
|
||||
'lines' => [['stock_item_id' => $this->f['stock']->id, 'quantity' => '4.000', 'use' => 'production', 'equipment_id' => null, 'production_reference' => 'OP-QA-001']]]);
|
||||
$event = exchangeDeliver($this);
|
||||
$page = $this->getJson('/stock/integracao/entregas')->assertOk()->assertJsonPath('items.0.lines.0.use', 'internal')->json();
|
||||
WarehouseFeed::validate($page, $this->f['tenant']->id);
|
||||
expect($this->r->fresh()->snapshot['lines'][0]['use'])->toBe('production')
|
||||
->and($event->data['lines'][0]['production']['reference'])->toBe('OP-QA-001');
|
||||
});
|
||||
|
||||
test('warehouse exchange publishes only physical facts with original identifiers and stable replay content', function () {
|
||||
$url = '/stock/integracao/entregas';
|
||||
$this->getJson($url)->assertOk()->assertJsonCount(0, 'items');
|
||||
|
||||
Reference in New Issue
Block a user