@@ -64,6 +64,8 @@ public function testLoginBadEmail(): void
6464
6565 public function testLoginActionEmailSuccess (): void
6666 {
67+ Time::setTestNow ('March 10, 2017 ' , 'America/Chicago ' );
68+
6769 $ this ->user ->createEmailIdentity ([
6870 'email ' => 'foo@example.com ' ,
6971 'password ' => 'secret123 ' ,
@@ -87,13 +89,15 @@ public function testLoginActionEmailSuccess(): void
8789 ]);
8890 // Last Used date should have been set
8991 $ identity = $ this ->user ->getEmailIdentity ();
90- $ this ->assertCloseEnough ( $ identity -> last_used_at -> getTimestamp (), Time:: now () ->getTimestamp ());
92+ $ this ->assertSame (Time:: now ()-> getTimestamp (), $ identity -> last_used_at ->getTimestamp ());
9193
9294 // Session should have `logged_in` value with user's id
9395 $ this ->assertSame ($ this ->user ->id , session ('user ' )['id ' ]);
96+
97+ Time::setTestNow ();
9498 }
9599
96- public function testAfterLoggedInNotDesplayLoginPage (): void
100+ public function testAfterLoggedInNotDisplayLoginPage (): void
97101 {
98102 $ this ->user ->createEmailIdentity ([
99103 'email ' => 'foo@example.com ' ,
@@ -111,6 +115,8 @@ public function testAfterLoggedInNotDesplayLoginPage(): void
111115
112116 public function testLoginActionUsernameSuccess (): void
113117 {
118+ Time::setTestNow ('March 10, 2017 ' , 'America/Chicago ' );
119+
114120 // Change the validation rules
115121 $ config = new class () extends Validation {
116122 public $ login = [
@@ -143,10 +149,12 @@ public function testLoginActionUsernameSuccess(): void
143149 ]);
144150 // Last Used date should have been set
145151 $ identity = $ this ->user ->getEmailIdentity ();
146- $ this ->assertCloseEnough ( $ identity -> last_used_at -> getTimestamp (), Time:: now () ->getTimestamp ());
152+ $ this ->assertSame (Time:: now ()-> getTimestamp (), $ identity -> last_used_at ->getTimestamp ());
147153
148154 // Session should have `logged_in` value with user's id
149155 $ this ->assertSame ($ this ->user ->id , session ('user ' )['id ' ]);
156+
157+ Time::setTestNow ();
150158 }
151159
152160 public function testLogoutAction (): void
0 commit comments