feat: integrate login/registration into PurchaseWizard
This commit is contained in:
@@ -64,7 +64,26 @@ class LoginTest extends TestCase
|
||||
$this->assertGuest();
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('login', absolute: false));
|
||||
$response->assertSessionHasErrors(['login' => 'Diese Anmeldedaten wurden nicht gefunden.']);
|
||||
$response->assertSessionHasErrors(['login' => 'Falsche Anmeldedaten.']);
|
||||
$this->assertSessionHas('error', 'Ungültige E-Mail oder Passwort.');
|
||||
}
|
||||
|
||||
public function test_login_success_shows_success_flash()
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'email' => 'success@example.com',
|
||||
'password' => bcrypt('password'),
|
||||
'email_verified_at' => now(),
|
||||
]);
|
||||
|
||||
$response = $this->post(route('login.store'), [
|
||||
'login' => 'success@example.com',
|
||||
'password' => 'password',
|
||||
]);
|
||||
|
||||
$this->assertAuthenticated();
|
||||
$response->assertRedirect(route('dashboard', absolute: false));
|
||||
$this->assertSessionHas('success', 'Sie sind nun eingeloggt.');
|
||||
}
|
||||
|
||||
public function test_login_redirects_unverified_user_to_verification_notice()
|
||||
|
||||
@@ -123,9 +123,30 @@ class RegistrationTest extends TestCase
|
||||
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHasErrors(['email' => 'Das E-Mail muss eine gültige E-Mail-Adresse sein.']);
|
||||
$this->assertSessionHas('error', 'Registrierung fehlgeschlagen.');
|
||||
$this->assertDatabaseMissing('users', ['email' => 'invalid-email']);
|
||||
}
|
||||
|
||||
public function test_registration_success_shows_success_flash()
|
||||
{
|
||||
$response = $this->post('/de/register', [
|
||||
'name' => 'Test User',
|
||||
'username' => 'successreg',
|
||||
'email' => 'successreg@example.com',
|
||||
'password' => 'Password123!',
|
||||
'password_confirmation' => 'Password123!',
|
||||
'first_name' => 'Max',
|
||||
'last_name' => 'Mustermann',
|
||||
'address' => 'Musterstr. 1',
|
||||
'phone' => '+49123456789',
|
||||
'privacy_consent' => true,
|
||||
]);
|
||||
|
||||
$this->assertAuthenticated();
|
||||
$response->assertRedirect(route('dashboard', absolute: false));
|
||||
$this->assertSessionHas('success', 'Registrierung erfolgreich – fortfahren mit Kauf.');
|
||||
}
|
||||
|
||||
public function test_registration_fails_with_short_password()
|
||||
{
|
||||
$response = $this->post('/de/register', [
|
||||
|
||||
Reference in New Issue
Block a user