public function testGetTokenChecksForRefreshToken()
 {
     $grant = new RefreshToken($this->createClient(), ['client_id' => 'test', 'client_secret' => 'clientSecret']);
     $this->setExpectedException('\\RuntimeException');
     $grant->getToken();
 }
 public function testSettingManualRefreshTokenWithRefreshTokenGrantType()
 {
     $credentials = ['client_id' => 'test', 'client_secret' => 'testSecret'];
     $client = $this->createClient([], []);
     $accessTokenGrantType = new ClientCredentials($client, $credentials);
     $refreshTokenGrantType = new RefreshToken($client, $credentials);
     $middleware = new OAuthMiddleware($client, $accessTokenGrantType, $refreshTokenGrantType);
     $token = new AccessToken('token', 'client_credentials', ['refresh_token' => 'refreshTokenOld']);
     $middleware->setAccessToken($token);
     $this->assertEquals('refreshTokenOld', $middleware->getRefreshToken()->getToken());
     $this->assertEquals('refreshTokenOld', $refreshTokenGrantType->getConfigByName(RefreshToken::CONFIG_REFRESH_TOKEN));
     $middleware->setRefreshToken('refreshToken');
     $this->assertEquals('refresh_token', $middleware->getRefreshToken()->getType());
     $this->assertEquals('refreshToken', $middleware->getRefreshToken()->getToken());
     $this->assertEquals('refreshToken', $refreshTokenGrantType->getConfigByName(RefreshToken::CONFIG_REFRESH_TOKEN));
 }