get('/register'); $response->assertStatus(200); }); test('new users register inactive and are sent to the verification notice', function () { /** @var TestCase $this */ Notification::fake(); Volt::test('auth.register') ->set('name', 'Test User') ->set('email', 'test@example.com') ->set('password', 'password') ->set('password_confirmation', 'password') ->set('terms_accepted', true) ->call('register') ->assertHasNoErrors() ->assertRedirect(route('verification.notice', absolute: false)); $this->assertAuthenticated(); $user = User::where('email', 'test@example.com')->firstOrFail(); // Konto bleibt bis zur Verifizierung inaktiv, rollenlos und unverifiziert. expect($user->is_active)->toBeFalse(); expect($user->hasVerifiedEmail())->toBeFalse(); expect($user->roles()->count())->toBe(0); // Die bestätigte AGB-/Datenschutz-Checkbox wird als Einwilligung festgehalten. expect($user->gdpr_consent_at)->not->toBeNull(); // Selbst-Registrierungen sind Neukunden — nie der DB-Default `existing_legacy`. expect($user->registration_type)->toBe(RegistrationType::Company); Notification::assertSentTo($user, VerifyEmail::class); }); test('registration requires accepting the terms', function () { /** @var TestCase $this */ Volt::test('auth.register') ->set('name', 'Test User') ->set('email', 'terms@example.com') ->set('password', 'password') ->set('password_confirmation', 'password') ->set('terms_accepted', false) ->call('register') ->assertHasErrors(['terms_accepted']); expect(User::where('email', 'terms@example.com')->exists())->toBeFalse(); });