isExpired() public method

Determine if the token is expired.
public isExpired ( DateTimeInterfac\DateTimeInterface $now = null ) : boolean
$now DateTimeInterfac\DateTimeInterface Defaults to the current time.
return boolean
Beispiel #1
0
 /**
  * @test
  *
  * @covers Lcobucci\JWT\Token::isExpired
  *
  * @uses Lcobucci\JWT\Token::__construct
  * @uses Lcobucci\JWT\Token::getClaim
  * @uses Lcobucci\JWT\Token::hasClaim
  * @uses Lcobucci\JWT\Claim\Basic
  * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
  */
 public function isExpiredShouldReturnTrueAfterTokenExpires()
 {
     $token = new Token(['alg' => 'none'], ['exp' => new GreaterOrEqualsTo('exp', time())]);
     $this->assertTrue($token->isExpired(new DateTime('+10 days')));
 }