@@ -63,6 +63,26 @@ test('explicit optional contract composition loads the selected standalone sourc
|
||||
->and(realpath((new ReflectionClass(BudgetControl::class))->getFileName()))->toBe(realpath($selected.'/src/BudgetControl.php'));
|
||||
});
|
||||
|
||||
test('prepared deployment capability verifies the selected standalone artifact outside QA and remains disabled by default', function () {
|
||||
$proofPath = base_path('docs/proofs/rq01-distribution-artifact.json');
|
||||
$proof = json_decode(file_get_contents($proofPath), true, 32, JSON_THROW_ON_ERROR);
|
||||
// Only the process which already loaded the frozen artifact can enable this composition.
|
||||
$selected = realpath((new ReflectionClass(BudgetControl::class))->getFileName());
|
||||
$artifact = base_path($proof['path']);
|
||||
config(['budget-distributions.qa_enabled' => false, 'budget-distributions.enabled' => false]);
|
||||
app()->instance('env', 'local');
|
||||
try {
|
||||
expect(app(RequisitionBudgetDistributions::class)->ready())->toBeFalse();
|
||||
config(['budget-distributions.enabled' => true, 'budget-distributions.artifact_manifest' => $proofPath,
|
||||
'budget-distributions.artifact_manifest_sha256' => hash_file('sha256', $proofPath), 'common-budget.path' => $artifact]);
|
||||
expect(app(RequisitionBudgetDistributions::class)->ready())->toBe($selected === realpath($artifact.'/src/BudgetControl.php'));
|
||||
config(['budget-distributions.artifact_manifest_sha256' => str_repeat('0', 64)]);
|
||||
expect(fn () => app(RequisitionBudgetDistributions::class)->ready())->toThrow(LogicException::class, 'BUDGET_DISTRIBUTION_MANIFEST_MISMATCH');
|
||||
} finally {
|
||||
app()->instance('env', 'testing');
|
||||
}
|
||||
});
|
||||
|
||||
function distributionInvoice(object $test, string $number, int $net, int $gross): Invoice
|
||||
{
|
||||
return Invoice::query()->create(['tenant_id' => $test->author->tenant_id, 'purchase_order_id' => $test->f['order']->id,
|
||||
|
||||
Reference in New Issue
Block a user