File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ public function hasExpired()
204204 throw new RuntimeException ('"expires" is not set on the token ' );
205205 }
206206
207- return $ expires < time ();
207+ return $ expires < $ this -> getTimeNow ();
208208 }
209209
210210 /**
Original file line number Diff line number Diff line change @@ -178,6 +178,22 @@ public function testHasExpiredWhenPropertySetInPast()
178178 self ::tearDownForBackwardsCompatibility ();
179179 }
180180
181+ public function testHasExpiredWhenTimeNowIsInFuture ()
182+ {
183+ $ options = [
184+ 'access_token ' => 'mock_access_token ' ,
185+ 'expires ' => time (),
186+ ];
187+
188+ $ token = $ this ->getAccessToken ($ options );
189+
190+ $ token ->setTimeNow (time () + 60 );
191+
192+ $ this ->assertTrue ($ token ->hasExpired ());
193+
194+ self ::tearDownForBackwardsCompatibility ();
195+ }
196+
181197 public function testCannotReportExpiredWhenNoExpirationSet ()
182198 {
183199 $ options = [
You can’t perform that action at this time.
0 commit comments