49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Tenant;
|
|
|
|
use App\Models\Event;
|
|
use App\Models\EventPackage;
|
|
use App\Models\Package;
|
|
|
|
class EventAddonControllerTest extends TenantTestCase
|
|
{
|
|
public function test_apply_endpoint_is_not_available_for_tenant_admins(): void
|
|
{
|
|
$package = Package::factory()->endcustomer()->create([
|
|
'max_photos' => 100,
|
|
'max_guests' => 50,
|
|
'gallery_days' => 7,
|
|
]);
|
|
|
|
$event = Event::factory()->for($this->tenant)->create([
|
|
'status' => 'published',
|
|
]);
|
|
|
|
$eventPackage = EventPackage::create([
|
|
'event_id' => $event->id,
|
|
'package_id' => $package->id,
|
|
'purchased_price' => $package->price,
|
|
'purchased_at' => now()->subDay(),
|
|
'used_photos' => 10,
|
|
'used_guests' => 5,
|
|
'gallery_expires_at' => now()->addDays(7),
|
|
]);
|
|
|
|
$response = $this->authenticatedRequest('POST', "/api/v1/tenant/events/{$event->slug}/addons/apply", [
|
|
'extra_photos' => 50,
|
|
'extra_guests' => 25,
|
|
'extend_gallery_days' => 3,
|
|
'reason' => 'Manual boost for event',
|
|
]);
|
|
|
|
$response->assertNotFound();
|
|
|
|
$eventPackage->refresh();
|
|
|
|
$this->assertSame(0, (int) $eventPackage->extra_photos);
|
|
$this->assertSame(0, (int) $eventPackage->extra_guests);
|
|
$this->assertSame(0, (int) $eventPackage->extra_gallery_days);
|
|
}
|
|
}
|