File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ public function definition(): array
2929 'email_verified_at ' => now (),
3030 'password ' => static ::$ password ??= Hash::make ('password ' ),
3131 'remember_token ' => Str::random (10 ),
32+ 'two_factor_secret ' => Str::random (10 ),
33+ 'two_factor_recovery_codes ' => Str::random (10 ),
34+ 'two_factor_confirmed_at ' => now (),
3235 ];
3336 }
3437
@@ -41,4 +44,16 @@ public function unverified(): static
4144 'email_verified_at ' => null ,
4245 ]);
4346 }
47+
48+ /**
49+ * Indicate that the model does not have two-factor authentication configured.
50+ */
51+ public function withoutTwoFactor (): static
52+ {
53+ return $ this ->state (fn (array $ attributes ) => [
54+ 'two_factor_secret ' => null ,
55+ 'two_factor_recovery_codes ' => null ,
56+ 'two_factor_confirmed_at ' => null ,
57+ ]);
58+ }
4459}
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function test_login_screen_can_be_rendered()
2121
2222 public function test_users_can_authenticate_using_the_login_screen ()
2323 {
24- $ user = User::factory ()->create ();
24+ $ user = User::factory ()->withoutTwoFactor ()-> create ();
2525
2626 $ response = $ this ->post (route ('login.store ' ), [
2727 'email ' => $ user ->email ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function test_two_factor_settings_page_can_be_rendered()
2323 'confirmPassword ' => true ,
2424 ]);
2525
26- $ user = User::factory ()->create ();
26+ $ user = User::factory ()->withoutTwoFactor ()-> create ();
2727
2828 $ this ->actingAs ($ user )
2929 ->withSession (['auth.password_confirmed_at ' => time ()])
You can’t perform that action at this time.
0 commit comments