commit compras1 2811
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-28 07:11:35 +02:00
parent d58b75c87a
commit eb32c74c56
202 changed files with 17463 additions and 1526 deletions
+12
View File
@@ -1,5 +1,6 @@
<?php
use App\Models\Requisition;
use App\Models\StockMovement;
use App\Models\StockOperation;
use App\Models\SupplyRecord;
@@ -10,6 +11,7 @@ use App\Services\InventoryDispositions;
use App\Services\InventoryLots;
use App\Services\InventoryReversals;
use App\Services\InvoiceWorkflow;
use App\Services\ProcurementDeliveryInsights;
use App\Services\ReceiptWorkflow;
use App\Services\RequisitionWorkflow;
use App\Services\StockWorkflow;
@@ -17,6 +19,7 @@ use App\Services\SupplyCoordination;
use App\Services\SupplyHistory;
use App\Services\SupplyPlanning;
use App\Services\WorkflowTaskInbox;
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
@@ -128,7 +131,14 @@ test('a reversal outside a closed history period invalidates its signature and c
});
test('receipt reversal restores authorised quantities without deleting acceptance and a new correction receipt is not a duplicate', function () {
supplyGrant($this->f['issuer'], ['procurement']);
$delivery = fn () => app(ProcurementDeliveryInsights::class)->build($this->f['issuer'], Requisition::query()->whereKey($this->f['r']->id),
CarbonImmutable::now(), null, 'all');
$this->actingAs($this->f['issuer']);
expect($delivery()['unverified_receipt_lines'])->toBe(0);
$executed = executeReversal($this, approvedReversal($this, ['source_kind' => 'receipt', 'receipt_item_id' => $this->receiptItem->id]));
$this->actingAs($this->f['issuer']);
expect($delivery()['unverified_receipt_lines'])->toBe(0);
expect(app(ReceiptWorkflow::class)->recordedQuantity($this->f['line']->id, 'received_milli'))->toBe(0)
->and(app(ReceiptWorkflow::class)->recordedQuantity($this->f['line']->id, 'accepted_milli'))->toBe(0)
->and($this->receiptItem->fresh()->accepted_milli)->toBe(10000)
@@ -140,6 +150,8 @@ test('receipt reversal restores authorised quantities without deleting acceptanc
expect(app(ReceiptWorkflow::class)->recordedQuantity($this->f['line']->id, 'accepted_milli'))->toBe(10000)
->and(app(StockWorkflow::class)->balance($this->f['stock']->id, $this->f['warehouse']->id)['quantity'])->toBe(10000)
->and($executed->snapshot['source']['receipt']['accepted_milli'])->toBe(10000);
$this->actingAs($this->f['issuer']);
expect($delivery()['unverified_receipt_lines'])->toBe(0);
});
test('receipt line reversal removes the full documentary quantities but only the accepted physical entry', function () {