/**
  * Create a new Oauth2 subscriber.
  *
  * @param ClientInterface                     $client
  * @param GrantTypeInterface|null             $grantType
  * @param RefreshTokenGrantTypeInterface|null $refreshTokenGrantType
  * @param array                               $options
  */
 public function __construct(ClientInterface $client, GrantTypeInterface $grantType = null, RefreshTokenGrantTypeInterface $refreshTokenGrantType = null, array $options = [])
 {
     parent::__construct($client, $grantType, $refreshTokenGrantType);
     $this->options = $options;
     $this->tokenExpiredOnFailureCount = 0;
 }
 public function testSettingManualRefreshToken()
 {
     $client = $this->createClient([], []);
     $middleware = new OAuthMiddleware($client);
     $token = new AccessToken('token', 'client_credentials', ['refresh_token' => 'refreshTokenOld']);
     $middleware->setAccessToken($token);
     $this->assertEquals('refreshTokenOld', $middleware->getRefreshToken()->getToken());
     $middleware->setRefreshToken('refreshToken');
     $this->assertEquals('refresh_token', $middleware->getRefreshToken()->getType());
     $this->assertEquals('refreshToken', $middleware->getRefreshToken()->getToken());
 }