44
55use Illuminate \Foundation \Auth \User ;
66use Illuminate \Foundation \Testing \RefreshDatabase ;
7+ use Illuminate \Support \Facades \Date ;
78use Laravel \Fortify \Contracts \ConfirmPasswordViewResponse ;
89use Laravel \Fortify \Fortify ;
910use Orchestra \Testbench \Attributes \WithMigration ;
@@ -40,6 +41,8 @@ public function test_the_confirm_password_view_is_returned()
4041
4142 public function test_password_can_be_confirmed ()
4243 {
44+ $ this ->freezeSecond ();
45+
4346 $ response = $ this ->withoutExceptionHandling ()
4447 ->actingAs ($ this ->user )
4548 ->withSession (['url.intended ' => 'http://foo.com/bar ' ])
@@ -48,7 +51,7 @@ public function test_password_can_be_confirmed()
4851 ['password ' => 'secret ' ]
4952 );
5053
51- $ response ->assertSessionHas ('auth.password_confirmed_at ' );
54+ $ response ->assertSessionHas ('auth.password_confirmed_at ' , Date:: now ()-> unix () );
5255 $ response ->assertRedirect ('http://foo.com/bar ' );
5356 }
5457
@@ -86,6 +89,8 @@ public function test_password_confirmation_can_fail_without_a_password()
8689
8790 public function test_password_confirmation_can_be_customized ()
8891 {
92+ $ this ->freezeSecond ();
93+
8994 Fortify::$ confirmPasswordsUsingCallback = function () {
9095 return true ;
9196 };
@@ -98,14 +103,16 @@ public function test_password_confirmation_can_be_customized()
98103 ['password ' => 'invalid ' ]
99104 );
100105
101- $ response ->assertSessionHas ('auth.password_confirmed_at ' );
106+ $ response ->assertSessionHas ('auth.password_confirmed_at ' , Date:: now ()-> unix () );
102107 $ response ->assertRedirect ('http://foo.com/bar ' );
103108
104109 Fortify::$ confirmPasswordsUsingCallback = null ;
105110 }
106111
107112 public function test_password_confirmation_can_be_customized_and_fail_without_password ()
108113 {
114+ $ this ->freezeSecond ();
115+
109116 Fortify::$ confirmPasswordsUsingCallback = function () {
110117 return true ;
111118 };
@@ -118,7 +125,7 @@ public function test_password_confirmation_can_be_customized_and_fail_without_pa
118125 ['password ' => null ]
119126 );
120127
121- $ response ->assertSessionHas ('auth.password_confirmed_at ' );
128+ $ response ->assertSessionHas ('auth.password_confirmed_at ' , Date:: now ()-> unix () );
122129 $ response ->assertRedirect ('http://foo.com/bar ' );
123130
124131 Fortify::$ confirmPasswordsUsingCallback = null ;
0 commit comments