get(route('register')); $response->assertSuccessful(); }); test('new users can register', function () { Queue::fake(); $response = $this->post(route('register.store'), [ 'name' => 'Test User', 'email' => 'test@example.com', 'password' => 'password', 'password_confirmation' => 'password', ]); $this->assertAuthenticated(); $response->assertRedirect(route('onboarding', absolute: false)); }); test('new users receive a verification email on registration', function () { Notification::fake(); $this->post(route('register.store'), [ 'name' => 'Test User', 'email' => 'test@example.com', 'password' => 'password', 'password_confirmation' => 'password', ]); $user = User::where('email', 'test@example.com')->first(); Notification::assertSentTo($user, VerifyEmailNotification::class); }); test('new users are not verified after registration', function () { Queue::fake(); $this->post(route('register.store'), [ 'name' => 'Test User', 'email' => 'test@example.com', 'password' => 'password', 'password_confirmation' => 'password', ]); $user = User::where('email', 'test@example.com')->first(); expect($user->hasVerifiedEmail())->toBeFalse(); });