public function testCanCheckIfATokenIsExpired()
 {
     $expiresAt = new DateTime();
     $expiresAt->sub(new DateInterval('PT60S'));
     $refreshToken = new RefreshToken();
     $refreshToken->setExpiresAt($expiresAt);
     $this->assertTrue($refreshToken->isExpired());
 }
 /**
  * @return RefreshToken
  */
 private function getValidRefreshToken()
 {
     $refreshToken = new RefreshToken();
     $refreshToken->setToken('azerty_refresh');
     $refreshToken->setScopes('read');
     $validDate = new DateTime();
     $validDate->add(DateInterval::createFromDateString('3600 seconds'));
     $refreshToken->setExpiresAt($validDate);
     return $refreshToken;
 }
 /**
  * @return RefreshToken
  */
 private function getValidRefreshToken()
 {
     $refreshToken = new RefreshToken();
     $refreshToken->setToken('azerty_refresh');
     $refreshToken->setScopes('read');
     $validDate = new DateTime();
     $validDate->add(new DateInterval('P1D'));
     $refreshToken->setExpiresAt($validDate);
     return $refreshToken;
 }