Implement compliance exports and retention overrides
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-02 20:13:45 +01:00
parent 5fd546c428
commit eed7699549
45 changed files with 2319 additions and 40 deletions

View File

@@ -2,12 +2,14 @@
namespace Tests\Feature\Console;
use App\Enums\RetentionOverrideScope;
use App\Jobs\ArchiveEventMediaAssets;
use App\Models\Event;
use App\Models\EventMediaAsset;
use App\Models\EventPackage;
use App\Models\MediaStorageTarget;
use App\Models\Package;
use App\Models\RetentionOverride;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Queue;
use Tests\TestCase;
@@ -94,4 +96,55 @@ class DispatchStorageArchiveCommandTest extends TestCase
Queue::assertNothingPushed();
}
public function test_skips_events_with_retention_override(): void
{
$target = MediaStorageTarget::create([
'key' => 'local-hot',
'name' => 'Local Hot',
'driver' => 'local',
'config' => ['monitor_path' => storage_path('app')],
'is_hot' => true,
'is_default' => true,
'is_active' => true,
'priority' => 100,
]);
$event = Event::factory()->create(['status' => 'published']);
$package = Package::factory()->create(['gallery_days' => 1]);
EventPackage::create([
'event_id' => $event->id,
'package_id' => $package->id,
'purchased_price' => 0,
'purchased_at' => now()->subDays(10),
'used_photos' => 0,
'used_guests' => 0,
'gallery_expires_at' => now()->subDays(5),
]);
EventMediaAsset::create([
'event_id' => $event->id,
'media_storage_target_id' => $target->id,
'variant' => 'original',
'disk' => 'local-hot',
'path' => 'events/'.$event->id.'/photo.jpg',
'size_bytes' => 1024,
'status' => 'hot',
]);
RetentionOverride::factory()->create([
'scope' => RetentionOverrideScope::EVENT,
'tenant_id' => $event->tenant_id,
'event_id' => $event->id,
]);
Queue::fake();
$this->artisan('storage:archive-pending')
->expectsOutput('Dispatched 0 archive job(s).')
->assertExitCode(0);
Queue::assertNothingPushed();
}
}