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
29
29
'email_verified_at ' => now (),
30
30
'password ' => static ::$ password ??= Hash::make ('password ' ),
31
31
'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 (),
32
35
];
33
36
}
34
37
@@ -41,4 +44,16 @@ public function unverified(): static
41
44
'email_verified_at ' => null ,
42
45
]);
43
46
}
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
+ }
44
59
}
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function test_login_screen_can_be_rendered(): void
21
21
22
22
public function test_users_can_authenticate_using_the_login_screen (): void
23
23
{
24
- $ user = User::factory ()->create ();
24
+ $ user = User::factory ()->withoutTwoFactor ()-> create ();
25
25
26
26
$ response = LivewireVolt::test ('auth.login ' )
27
27
->set ('email ' , $ user ->email )
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ protected function setUp(): void
28
28
29
29
public function test_two_factor_settings_page_can_be_rendered (): void
30
30
{
31
- $ user = User::factory ()->create ();
31
+ $ user = User::factory ()->withoutTwoFactor ()-> create ();
32
32
33
33
$ this ->actingAs ($ user )
34
34
->withSession (['auth.password_confirmed_at ' => time ()])
You can’t perform that action at this time.
0 commit comments