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

@@ -0,0 +1,104 @@
<?php
namespace Tests\Feature\Dashboard;
use App\Models\Event;
use App\Models\Package;
use App\Models\PackagePurchase;
use App\Models\Photo;
use App\Models\Task;
use App\Models\Tenant;
use App\Models\TenantPackage;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\AssertableInertia;
use Tests\TestCase;
class DashboardPageTest extends TestCase
{
use RefreshDatabase;
public function test_unverified_user_can_access_dashboard_with_summary_data(): void
{
$tenant = Tenant::factory()->create([
'event_credits_balance' => 4,
]);
$package = Package::factory()->reseller()->create([
'name_translations' => [
'de' => 'Premium Paket',
'en' => 'Premium Package',
],
'max_events_per_year' => 10,
]);
TenantPackage::factory()->create([
'tenant_id' => $tenant->id,
'package_id' => $package->id,
'price' => 149.00,
'purchased_at' => now()->subDay(),
'expires_at' => now()->addMonth(),
'used_events' => 1,
'active' => true,
]);
$user = User::factory()
->unverified()
->create([
'tenant_id' => $tenant->id,
'role' => 'tenant_admin',
]);
$event = Event::factory()->for($tenant)->create([
'status' => 'published',
'is_active' => true,
'date' => now()->addDays(7),
'name' => ['de' => 'Sommerfest', 'en' => 'Summer Party'],
]);
$task = Task::factory()->create([
'tenant_id' => $tenant->id,
'is_completed' => true,
]);
$event->tasks()->attach($task);
Photo::factory()->for($event)->create([
'tenant_id' => $tenant->id,
'created_at' => now()->subDay(),
]);
PackagePurchase::factory()->create([
'tenant_id' => $tenant->id,
'package_id' => $package->id,
'price' => 149.00,
'type' => 'reseller_subscription',
'provider' => 'paddle',
'purchased_at' => now()->subDay(),
]);
$this->actingAs($user);
$response = $this->get(route('dashboard'));
$response->assertStatus(200)
->assertInertia(fn (AssertableInertia $page) => $page
->component('dashboard')
->has('metrics', fn (AssertableInertia $metrics) => $metrics
->where('active_events', 1)
->where('total_events', 1)
->where('task_progress', 100)
->where('upcoming_events', 1)
->where('new_photos', 1)
->where('credit_balance', 4)
->etc()
)
->where('tenant.activePackage.name', 'Premium Paket')
->where('tenant.activePackage.remainingEvents', 9)
->has('upcomingEvents', 1)
->has('recentPurchases', 1)
->where('emailVerification.mustVerify', true)
->where('emailVerification.verified', false)
);
}
}