die tenant admin oauth authentifizierung wurde implementiert und funktioniert jetzt. Zudem wurde das marketing frontend dashboard implementiert.

This commit is contained in:
Codex Agent
2025-11-04 16:14:17 +01:00
parent 92e64c361a
commit fe380689fb
63 changed files with 4239 additions and 1142 deletions

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature\Tenant;
use App\Models\EventType;
use App\Models\Package;
use Illuminate\Support\Carbon;
class EventCreditsTest extends TenantTestCase
@@ -12,6 +13,20 @@ class EventCreditsTest extends TenantTestCase
$this->tenant->update(['event_credits_balance' => 0]);
$eventType = EventType::factory()->create();
$package = Package::factory()->create([
'type' => 'endcustomer',
'price' => 0,
'gallery_days' => 30,
]);
$this->tenant->tenantPackages()->create([
'package_id' => $package->id,
'price' => $package->price,
'purchased_at' => now()->subDay(),
'expires_at' => now()->addMonth(),
'active' => true,
]);
$payload = [
'name' => 'Sample Event',
'description' => 'Test description',
@@ -22,9 +37,8 @@ class EventCreditsTest extends TenantTestCase
$response = $this->authenticatedRequest('POST', '/api/v1/tenant/events', $payload);
$response->assertStatus(402)
->assertJson([
'error' => 'Insufficient event credits. Please purchase more credits.',
]);
->assertJsonPath('error.code', 'event_credits_exhausted')
->assertJsonPath('error.meta.balance', 0);
$this->tenant->update(['event_credits_balance' => 2]);
@@ -32,15 +46,14 @@ class EventCreditsTest extends TenantTestCase
$createResponse->assertStatus(201)
->assertJsonPath('message', 'Event created successfully')
->assertJsonPath('balance', 1);
->assertJsonPath('data.package.id', $package->id);
$this->tenant->refresh();
$this->assertSame(1, $this->tenant->event_credits_balance);
$createdEventId = $createResponse->json('data.id');
$this->assertDatabaseHas('event_credits_ledger', [
'tenant_id' => $this->tenant->id,
'delta' => -1,
'reason' => 'event_create',
$this->assertNotNull($createdEventId);
$this->assertDatabaseHas('event_packages', [
'event_id' => $createdEventId,
'package_id' => $package->id,
]);
}
}