- Tenant-Admin-PWA: Neues /event-admin/welcome Onboarding mit WelcomeHero, Packages-, Order-Summary- und Event-Setup-Pages, Zustandsspeicher, Routing-Guard und Dashboard-CTA für Erstnutzer; Filament-/admin-Login via Custom-View behoben.
- Brand/Theming: Marketing-Farb- und Typographievariablen in `resources/css/app.css` eingeführt, AdminLayout, Dashboardkarten und Onboarding-Komponenten entsprechend angepasst; Dokumentation (`docs/todo/tenant-admin-onboarding-fusion.md`, `docs/changes/...`) aktualisiert. - Checkout & Payments: Checkout-, PayPal-Controller und Tests für integrierte Stripe/PayPal-Flows sowie Paket-Billing-Abläufe überarbeitet; neue PayPal SDK-Factory und Admin-API-Helper (`resources/js/admin/api.ts`) schaffen Grundlage für Billing/Members/Tasks-Seiten. - DX & Tests: Neue Playwright/E2E-Struktur (docs/testing/e2e.md, `tests/e2e/tenant-onboarding-flow.test.ts`, Utilities), E2E-Tenant-Seeder und zusätzliche Übersetzungen/Factories zur Unterstützung der neuen Flows. - Marketing-Kommunikation: Automatische Kontakt-Bestätigungsmail (`ContactConfirmation` + Blade-Template) implementiert; Guest-PWA unter `/event` erreichbar. - Nebensitzung: Blogsystem gefixt und umfassenden BlogPostSeeder für Beispielinhalte angelegt.
This commit is contained in:
@@ -2,30 +2,35 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Mail\Welcome;
|
||||
use App\Models\Package;
|
||||
use App\Models\User;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\TenantPackage;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\Welcome;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Tests\TestCase;
|
||||
|
||||
class RegistrationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_registration_creates_user_and_tenant()
|
||||
private function captureLocation($response): string
|
||||
{
|
||||
$redirect = $response->headers->get('Location');
|
||||
$location = $redirect ?? $response->headers->get('X-Inertia-Location');
|
||||
|
||||
return $location ?? '';
|
||||
}
|
||||
|
||||
public function test_registration_creates_user_and_tenant(): void
|
||||
{
|
||||
$freePackage = Package::factory()->create(['price' => 0]);
|
||||
|
||||
$response = $this->post(route('register.store'), [
|
||||
'username' => 'testuser',
|
||||
'email' => 'test@example.com',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
'password' => 'Password123!',
|
||||
'password_confirmation' => 'Password123!',
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'address' => 'Test Address',
|
||||
@@ -34,7 +39,11 @@ class RegistrationTest extends TestCase
|
||||
'package_id' => $freePackage->id,
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('verification.notice', absolute: false));
|
||||
$location = $this->captureLocation($response);
|
||||
$expected = route('dashboard', absolute: false);
|
||||
|
||||
$this->assertNotEmpty($location);
|
||||
$this->assertTrue($location === $expected || Str::endsWith($location, $expected));
|
||||
|
||||
$this->assertDatabaseHas('users', [
|
||||
'username' => 'testuser',
|
||||
@@ -59,13 +68,13 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_registration_without_package()
|
||||
public function test_registration_without_package_assigns_tenant_only(): void
|
||||
{
|
||||
$response = $this->post(route('register.store'), [
|
||||
'username' => 'testuser2',
|
||||
'email' => 'test2@example.com',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
'password' => 'Password123!',
|
||||
'password_confirmation' => 'Password123!',
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'address' => 'Test Address',
|
||||
@@ -73,7 +82,11 @@ class RegistrationTest extends TestCase
|
||||
'privacy_consent' => true,
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('verification.notice', absolute: false));
|
||||
$location = $this->captureLocation($response);
|
||||
$expected = route('dashboard', absolute: false);
|
||||
|
||||
$this->assertNotEmpty($location);
|
||||
$this->assertTrue($location === $expected || Str::endsWith($location, $expected));
|
||||
|
||||
$user = User::where('email', 'test2@example.com')->first();
|
||||
$this->assertNotNull($user->tenant);
|
||||
@@ -81,12 +94,13 @@ class RegistrationTest extends TestCase
|
||||
'email' => 'test2@example.com',
|
||||
'role' => 'user',
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('tenant_packages', [
|
||||
'tenant_id' => $user->tenant->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_registration_validation_fails()
|
||||
public function test_registration_validation_fails(): void
|
||||
{
|
||||
$response = $this->post(route('register.store'), [
|
||||
'username' => '',
|
||||
@@ -105,15 +119,15 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_registration_with_paid_package_returns_inertia_redirect()
|
||||
public function test_registration_with_paid_package_redirects_to_checkout_flow(): void
|
||||
{
|
||||
$paidPackage = Package::factory()->create(['price' => 10.00]);
|
||||
|
||||
$response = $this->post(route('register.store'), [
|
||||
'username' => 'paiduser',
|
||||
'email' => 'paid@example.com',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
'password' => 'Password123!',
|
||||
'password_confirmation' => 'Password123!',
|
||||
'first_name' => 'Paid',
|
||||
'last_name' => 'User',
|
||||
'address' => 'Paid Address',
|
||||
@@ -122,26 +136,26 @@ class RegistrationTest extends TestCase
|
||||
'package_id' => $paidPackage->id,
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('buy.packages', $paidPackage->id));
|
||||
$response->assertRedirect(route('marketing.buy', $paidPackage->id));
|
||||
|
||||
$this->assertDatabaseHas('users', [
|
||||
'username' => 'paiduser',
|
||||
'email' => 'paid@example.com',
|
||||
'role' => 'user', // No upgrade for paid until payment
|
||||
'role' => 'user',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_registered_event_sends_welcome_email()
|
||||
public function test_registered_event_sends_welcome_email(): void
|
||||
{
|
||||
Mail::fake();
|
||||
|
||||
$freePackage = Package::factory()->create(['price' => 0]);
|
||||
|
||||
$response = $this->post(route('register.store'), [
|
||||
$this->post(route('register.store'), [
|
||||
'username' => 'testuser3',
|
||||
'email' => 'test3@example.com',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
'password' => 'Password123!',
|
||||
'password_confirmation' => 'Password123!',
|
||||
'first_name' => 'Test',
|
||||
'last_name' => 'User',
|
||||
'address' => 'Test Address',
|
||||
@@ -151,7 +165,7 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
Mail::assertQueued(Welcome::class, function ($mail) {
|
||||
return $mail->to[0]['address'] === 'test3@example.com';
|
||||
return $mail->hasTo('test3@example.com');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user