setExpireDuration() публичный Метод

Sets token expire duration.
public setExpireDuration ( string $expireDuration )
$expireDuration string token expiration duration.
Пример #1
1
 /**
  * @dataProvider apiUrlDataProvider
  *
  * @param $apiBaseUrl
  * @param $apiSubUrl
  * @param $expectedApiFullUrl
  */
 public function testApiUrl($apiBaseUrl, $apiSubUrl, $expectedApiFullUrl)
 {
     $oauthClient = $this->createOAuthClient();
     $oauthClient->expects($this->any())->method('apiInternal')->will($this->returnArgument(1));
     $accessToken = new OAuthToken();
     $accessToken->setToken('test_access_token');
     $accessToken->setExpireDuration(1000);
     $oauthClient->setAccessToken($accessToken);
     $oauthClient->apiBaseUrl = $apiBaseUrl;
     $this->assertEquals($expectedApiFullUrl, $oauthClient->api($apiSubUrl));
 }
Пример #2
-1
 /**
  * @depends testGetIsExpired
  */
 public function testGetIsValid()
 {
     $oauthToken = new OAuthToken();
     $expireDuration = 3600;
     $oauthToken->setExpireDuration($expireDuration);
     $this->assertFalse($oauthToken->getIsValid(), 'Empty token is valid!');
     $oauthToken->setToken('test_token');
     $this->assertTrue($oauthToken->getIsValid(), 'Filled up token is invalid!');
     $oauthToken->createTimestamp = $oauthToken->createTimestamp - ($expireDuration + 1);
     $this->assertFalse($oauthToken->getIsValid(), 'Expired token is valid!');
 }