@@ -24,14 +24,27 @@ use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Tempo\Finance\Budget\BudgetLandedCostPlan;
|
||||
use Tempo\Finance\GeneralLedger\LedgerSchema;
|
||||
|
||||
require_once __DIR__.'/../Support/ReceiptFixture.php';
|
||||
require_once __DIR__.'/../Support/SupplyFixture.php';
|
||||
require_once __DIR__.'/../Support/RequisitionLedgerQaRuntime.php';
|
||||
|
||||
beforeEach(function () {
|
||||
if (! class_exists(BudgetLandedCostPlan::class)) {
|
||||
$this->markTestSkipped('Select the authorized unpublished common source for isolated QA.');
|
||||
}
|
||||
if (getenv('RQ01_LEDGER_INTEGRATED_SCHEMA') === '1') {
|
||||
$source = requisitionLedgerQaSource();
|
||||
if ($source === null) {
|
||||
throw new LogicException('Integrated import costs require the dedicated actual-ledger QA runner.');
|
||||
}
|
||||
require_once $source.'/bootstrap.php';
|
||||
LedgerSchema::install(DB::connection());
|
||||
require_once __DIR__.'/../Support/IntegratedPurchasingQaSchema.php';
|
||||
$composition = integratedPurchasingQaSchema();
|
||||
expect($composition['verified_tables'])->toHaveCount(12);
|
||||
}
|
||||
config(['import-landed-costs.qa_enabled' => true]);
|
||||
Storage::fake('local');
|
||||
$this->f = receiptFixture();
|
||||
@@ -94,7 +107,9 @@ test('technical inspection detects private import evidence loss alteration and o
|
||||
});
|
||||
|
||||
test('cost to item references are frozen in reviewed preparations without stock valuation or financial effects', function () {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
if (getenv('RQ01_LEDGER_INTEGRATED_SCHEMA') !== '1') {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
}
|
||||
$service = app(ImportLandedCosts::class);
|
||||
$document = $service->recordDocument($this->finance, $this->import, $this->input, $this->file);
|
||||
$selection = [...importCostSelection($this, $document), 'item_references' => [
|
||||
@@ -299,7 +314,9 @@ test('a documentary correction preserves both original bytes and values and inva
|
||||
});
|
||||
|
||||
test('the native independently reviewed cost plan reserves commits and consumes the additional origin once', function () {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
if (getenv('RQ01_LEDGER_INTEGRATED_SCHEMA') !== '1') {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
}
|
||||
$service = app(ImportLandedCosts::class);
|
||||
$document = $service->recordDocument($this->finance, $this->import, $this->input, $this->file);
|
||||
$draft = $service->save($this->finance, $this->import, ['operation_key' => (string) Str::uuid(), 'record_key' => null, 'version' => 0,
|
||||
@@ -344,7 +361,9 @@ function approvedImportCostPreparation(object $test): array
|
||||
}
|
||||
|
||||
test('logistics progression does not revoke a reviewed cost preparation or require another financial approval', function () {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
if (getenv('RQ01_LEDGER_INTEGRATED_SCHEMA') !== '1') {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
}
|
||||
[, $approved] = approvedImportCostPreparation($this);
|
||||
$service = app(ImportLandedCosts::class);
|
||||
$service->financial($this->finance, $this->import, $approved, ['operation_key' => (string) Str::uuid(), 'action' => 'reserve', 'financial_revision' => 0,
|
||||
@@ -362,7 +381,9 @@ test('logistics progression does not revoke a reviewed cost preparation or requi
|
||||
});
|
||||
|
||||
test('a failed native financial receipt rolls back the common journal and its audit together', function () {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
if (getenv('RQ01_LEDGER_INTEGRATED_SCHEMA') !== '1') {
|
||||
(require __DIR__.'/../../database/qa-migrations/2026_11_22_000009_create_budget_landed_costs.php')->up();
|
||||
}
|
||||
[, $approved] = approvedImportCostPreparation($this);
|
||||
if (DB::getDriverName() === 'pgsql') {
|
||||
DB::unprepared("CREATE FUNCTION reject_synthetic_import_cost_receipt() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF NEW.kind = 'import_cost_event' THEN RAISE EXCEPTION 'Synthetic receipt failure'; END IF; RETURN NEW; END $$;
|
||||
|
||||
Reference in New Issue
Block a user