commit compras1 3011
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-30 09:33:36 +02:00
parent 96b30368bc
commit 47649bd46c
163 changed files with 9419 additions and 145 deletions
@@ -67,6 +67,41 @@ beforeEach(function () {
$this->actingAs($this->f['issuer']);
});
test('standalone audit uses ordinary private application storage and refuses public or external roots', function () {
config(['private-audit.qa_enabled' => false]);
$original = config('filesystems.disks.local');
$root = storage_path('app/release-audit-'.Str::uuid());
$external = sys_get_temp_dir().DIRECTORY_SEPARATOR.'release-audit-'.Str::uuid();
mkdir($root, 0700, true);
mkdir($external, 0700);
$files = null;
try {
config(['filesystems.disks.local.root' => $root]);
\Illuminate\Support\Facades\Storage::forgetDisk('local');
expect(app(\App\Services\PrivateAuditAccess::class)->ready())->toBeTrue();
$files = new \App\Services\PrivateAuditFiles($this->f['issuer']);
$written = $files->write('probe.ndjson', "{\"synthetic\":true}\n");
expect(file_get_contents($written['path']))->toBe("{\"synthetic\":true}\n")
->and($written['sha256'])->toBe(hash('sha256', "{\"synthetic\":true}\n"));
foreach ([public_path(), storage_path('app/public'), $external] as $invalid) {
config(['filesystems.disks.local.root' => $invalid]);
\Illuminate\Support\Facades\Storage::forgetDisk('local');
expect(fn () => new \App\Services\PrivateAuditFiles($this->f['issuer']))->toThrow(\Symfony\Component\HttpKernel\Exception\HttpException::class);
}
} finally {
$files?->cleanup();
config(['filesystems.disks.local' => $original]);
\Illuminate\Support\Facades\Storage::forgetDisk('local');
$resolved = realpath($root);
if ($resolved !== false && dirname($resolved) === realpath(storage_path('app')) && str_starts_with(basename($resolved), 'release-audit-')) {
\Illuminate\Support\Facades\File::deleteDirectory($resolved);
}
if (is_dir($external) && count(scandir($external) ?: []) === 2) {
rmdir($external);
}
}
});
test('standalone candidate preserves explicit line account attribution without a journal or a parallel budget writer', function () {
$request = $this->f['r'];
$request->update(['status' => 'draft']);