das marketing frontend wurde auf lokalisierte urls umgestellt.
This commit is contained in:
@@ -13,9 +13,9 @@ class RegistrationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private function assertRedirectsToDashboard($response): void
|
||||
private function assertRedirectsToVerification($response): void
|
||||
{
|
||||
$expected = route('dashboard', absolute: false);
|
||||
$expected = route('verification.notice', absolute: false);
|
||||
$target = $response->headers->get('Location')
|
||||
?? $response->headers->get('X-Inertia-Location');
|
||||
|
||||
@@ -23,7 +23,7 @@ class RegistrationTest extends TestCase
|
||||
|
||||
$this->assertTrue(
|
||||
$target === $expected || Str::endsWith($target, $expected),
|
||||
'Registration should redirect or instruct Inertia to navigate to the dashboard.'
|
||||
'Registration should redirect or instruct Inertia to navigate to the verification notice.'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->assertAuthenticated();
|
||||
$this->assertRedirectsToDashboard($response);
|
||||
$this->assertRedirectsToVerification($response);
|
||||
$this->assertDatabaseHas('users', ['email' => 'test@example.com']);
|
||||
$this->assertDatabaseHas('tenants', [
|
||||
'user_id' => User::latest()->first()->id,
|
||||
@@ -76,7 +76,7 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->assertAuthenticated();
|
||||
$this->assertRedirectsToDashboard($response);
|
||||
$this->assertRedirectsToVerification($response);
|
||||
|
||||
$user = User::latest()->first();
|
||||
$tenant = Tenant::where('user_id', $user->id)->first();
|
||||
@@ -116,7 +116,10 @@ class RegistrationTest extends TestCase
|
||||
'package_id' => $paidPackage->id,
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('marketing.buy', $paidPackage->id));
|
||||
$response->assertRedirect(route('buy.packages', [
|
||||
'locale' => 'de',
|
||||
'packageId' => $paidPackage->id,
|
||||
]));
|
||||
$this->assertDatabaseHas('users', ['email' => 'paid@example.com']);
|
||||
$this->assertDatabaseMissing('tenant_packages', ['package_id' => $paidPackage->id]);
|
||||
}
|
||||
@@ -157,7 +160,7 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->assertAuthenticated();
|
||||
$this->assertRedirectsToDashboard($response);
|
||||
$this->assertRedirectsToVerification($response);
|
||||
}
|
||||
|
||||
public function test_registration_fails_with_short_password(): void
|
||||
|
||||
@@ -131,7 +131,10 @@ class FullUserFlowTest extends TestCase
|
||||
});
|
||||
|
||||
// Finaler Redirect zu Success oder Dashboard
|
||||
$successResponse = $this->actingAs($user)->get(route('marketing.success', $paidPackage->id));
|
||||
$successResponse = $this->actingAs($user)->get(route('marketing.success', [
|
||||
'locale' => 'de',
|
||||
'packageId' => $paidPackage->id,
|
||||
]));
|
||||
$successResponse->assertRedirect('/event-admin');
|
||||
$successResponse->assertStatus(302);
|
||||
}
|
||||
@@ -181,7 +184,10 @@ class FullUserFlowTest extends TestCase
|
||||
|
||||
// Schritt 3: Bestellung ohne Auth blockiert
|
||||
$package = Package::factory()->create(['price' => 10]);
|
||||
$buyResponse = $this->get(route('buy.packages', $package->id));
|
||||
$buyResponse = $this->get(route('buy.packages', [
|
||||
'locale' => 'de',
|
||||
'packageId' => $package->id,
|
||||
]));
|
||||
$buyResponse->assertRedirect(route('register', ['package_id' => $package->id]));
|
||||
|
||||
// Nach Korrektur: Erfolgreicher Flow (kurz)
|
||||
|
||||
73
tests/Feature/MarketingLocaleRoutingTest.php
Normal file
73
tests/Feature/MarketingLocaleRoutingTest.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class MarketingLocaleRoutingTest extends TestCase
|
||||
{
|
||||
public function test_contact_page_is_accessible_in_german(): void
|
||||
{
|
||||
$response = $this->get('/de/kontakt');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_contact_page_is_accessible_in_english(): void
|
||||
{
|
||||
$response = $this->get('/en/contact');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_german_contact_slug_redirects_to_english_variant_when_locale_is_english(): void
|
||||
{
|
||||
$response = $this->get('/en/kontakt');
|
||||
|
||||
$response->assertRedirect(route('marketing.contact', [
|
||||
'locale' => 'en',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_english_contact_slug_redirects_to_german_variant_when_locale_is_german(): void
|
||||
{
|
||||
$response = $this->get('/de/contact');
|
||||
|
||||
$response->assertRedirect(route('kontakt', [
|
||||
'locale' => 'de',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_occasion_canonical_slugs_resolve_for_both_locales(): void
|
||||
{
|
||||
$this->get('/de/anlaesse/hochzeit')->assertStatus(200);
|
||||
$this->get('/en/occasions/wedding')->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_english_locale_redirects_from_german_occasions_slug(): void
|
||||
{
|
||||
$response = $this->get('/en/anlaesse/hochzeit');
|
||||
|
||||
$response->assertRedirect(route('occasions.type', [
|
||||
'locale' => 'en',
|
||||
'type' => 'wedding',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_german_locale_redirects_from_english_occasions_slug(): void
|
||||
{
|
||||
$response = $this->get('/de/occasions/wedding');
|
||||
|
||||
$response->assertRedirect(route('anlaesse.type', [
|
||||
'locale' => 'de',
|
||||
'type' => 'hochzeit',
|
||||
]));
|
||||
}
|
||||
|
||||
public function test_legal_pages_render_for_german_locale(): void
|
||||
{
|
||||
$this->get('/de/impressum')->assertStatus(200);
|
||||
$this->get('/de/datenschutz')->assertStatus(200);
|
||||
$this->get('/de/agb')->assertStatus(200);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
$location = $this->captureLocation($response);
|
||||
$expected = route('dashboard', absolute: false);
|
||||
$expected = route('verification.notice', absolute: false);
|
||||
|
||||
$this->assertNotEmpty($location);
|
||||
$this->assertTrue($location === $expected || Str::endsWith($location, $expected));
|
||||
@@ -83,7 +83,7 @@ class RegistrationTest extends TestCase
|
||||
]);
|
||||
|
||||
$location = $this->captureLocation($response);
|
||||
$expected = route('dashboard', absolute: false);
|
||||
$expected = route('verification.notice', absolute: false);
|
||||
|
||||
$this->assertNotEmpty($location);
|
||||
$this->assertTrue($location === $expected || Str::endsWith($location, $expected));
|
||||
@@ -136,7 +136,10 @@ class RegistrationTest extends TestCase
|
||||
'package_id' => $paidPackage->id,
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('marketing.buy', $paidPackage->id));
|
||||
$response->assertRedirect(route('buy.packages', [
|
||||
'locale' => 'de',
|
||||
'packageId' => $paidPackage->id,
|
||||
]));
|
||||
|
||||
$this->assertDatabaseHas('users', [
|
||||
'username' => 'paiduser',
|
||||
@@ -164,7 +167,7 @@ class RegistrationTest extends TestCase
|
||||
'package_id' => $freePackage->id,
|
||||
]);
|
||||
|
||||
Mail::assertQueued(Welcome::class, function ($mail) {
|
||||
Mail::assertSent(Welcome::class, function ($mail) {
|
||||
return $mail->hasTo('test3@example.com');
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user