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

This commit is contained in:
2026-11-22 16:28:03 +02:00
parent efd97e265b
commit 36dcfdf00c
118 changed files with 6042 additions and 92 deletions
+12
View File
@@ -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');