Example #1
0
 public function testConstructorMinimumParameters()
 {
     $accessToken = new AccessToken(['token' => 'foo', 'type' => 'bearer', 'clientId' => '123', 'userId' => 'bar', 'lifetime' => 60]);
     $this->assertSame(['token' => 'foo', 'type' => 'bearer', 'clientId' => '123', 'userId' => 'bar', 'createdAt' => time(), 'lifetime' => 60, 'scope' => null], $accessToken->getParams());
 }
Example #2
0
 public function testGetLifetimeFromNowShouldReturnExpiresAtLessTime()
 {
     $accessToken = new \Akamon\OAuth2\Server\Domain\Model\AccessToken\AccessToken(['clientId' => '123', 'userId' => 'bar', 'type' => 'bearer', 'token' => 'foo', 'createdAt' => time(), 'lifetime' => 60]);
     $this->assertSame($accessToken->expiresAt() - time(), $accessToken->lifetimeFromNow());
 }