/**
  * @dataProvider rotateRefreshToken
  */
 public function testCanCreateTokenResponse($rotateRefreshToken)
 {
     $request = $this->getMock(ServerRequestInterface::class);
     $request->expects($this->once())->method('getParsedBody')->willReturn(['refresh_token' => '123', 'scope' => 'read']);
     $owner = $this->getMock(TokenOwnerInterface::class);
     $owner->expects($this->once())->method('getTokenOwnerId')->will($this->returnValue(1));
     $refreshToken = $this->getValidRefreshToken();
     $refreshToken->setScopes(['read']);
     $refreshToken->setOwner($owner);
     $this->refreshTokenService->expects($this->once())->method('getToken')->with('123')->will($this->returnValue($refreshToken));
     if ($rotateRefreshToken) {
         $this->refreshTokenService->expects($this->once())->method('deleteToken')->with($refreshToken);
         $refreshToken = $this->getValidRefreshToken();
         $this->refreshTokenService->expects($this->once())->method('createToken')->will($this->returnValue($refreshToken));
     }
     $accessToken = $this->getValidAccessToken();
     $accessToken->setOwner($owner);
     $this->accessTokenService->expects($this->once())->method('createToken')->will($this->returnValue($accessToken));
     $this->grant->setRotateRefreshTokens($rotateRefreshToken);
     $response = $this->grant->createTokenResponse($request, new Client());
     $body = json_decode($response->getBody(), true);
     $this->assertEquals('azerty_access', $body['access_token']);
     $this->assertEquals('Bearer', $body['token_type']);
     $this->assertEquals(3600, $body['expires_in']);
     $this->assertEquals('read', $body['scope']);
     $this->assertEquals(1, $body['owner_id']);
     $this->assertEquals('azerty_refresh', $body['refresh_token']);
 }
 public function testMethodAllowPublicClients()
 {
     $grant = new RefreshTokenGrant($this->accessTokenService, $this->refreshTokenService, ServerOptions::fromArray());
     $this->assertTrue($grant->allowPublicClients());
 }