Limit-Status im Upload-Flow anzeigen (Warnbanner + Sperrzustände).
Upload-Fehlercodes auswerten und freundliche Dialoge zeigen.
This commit is contained in:
@@ -131,4 +131,40 @@ class EventGuestUploadLimitTest extends TestCase
|
||||
$this->assertGreaterThanOrEqual(2, $thresholdJobs->count());
|
||||
Bus::assertDispatched(SendEventPackagePhotoLimitNotification::class);
|
||||
}
|
||||
|
||||
public function test_guest_package_endpoint_returns_limits_summary(): void
|
||||
{
|
||||
$tenant = Tenant::factory()->create();
|
||||
$event = Event::factory()->for($tenant)->create([
|
||||
'status' => 'published',
|
||||
]);
|
||||
|
||||
$package = Package::factory()->endcustomer()->create([
|
||||
'max_photos' => 10,
|
||||
'max_guests' => 20,
|
||||
'gallery_days' => 7,
|
||||
]);
|
||||
|
||||
$eventPackage = EventPackage::create([
|
||||
'event_id' => $event->id,
|
||||
'package_id' => $package->id,
|
||||
'purchased_price' => $package->price,
|
||||
'purchased_at' => now()->subDay(),
|
||||
'used_photos' => 8,
|
||||
'used_guests' => 5,
|
||||
'gallery_expires_at' => now()->addDays(3),
|
||||
]);
|
||||
|
||||
$token = app(EventJoinTokenService::class)->createToken($event)->plain_token;
|
||||
|
||||
$response = $this->getJson("/api/v1/events/{$token}/package");
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('id', $eventPackage->id);
|
||||
$response->assertJsonPath('limits.photos.limit', 10);
|
||||
$response->assertJsonPath('limits.photos.used', 8);
|
||||
$response->assertJsonPath('limits.photos.state', 'warning');
|
||||
$response->assertJsonPath('limits.gallery.state', 'warning');
|
||||
$response->assertJsonPath('limits.can_upload_photos', true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user