mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	Added setAccessTokenId method
This commit is contained in:
		@@ -8,8 +8,21 @@ use League\OAuth2\Server\Entity\AccessTokenEntity;
 | 
			
		||||
use League\OAuth2\Server\Entity\RefreshTokenEntity;
 | 
			
		||||
use \Mockery as M;
 | 
			
		||||
 | 
			
		||||
class RefreshTokenTest extends \PHPUnit_Framework_TestCase
 | 
			
		||||
class RefreshTokenEntityTest extends \PHPUnit_Framework_TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testSetAccessTokenId()
 | 
			
		||||
    {
 | 
			
		||||
        $server = M::mock('League\OAuth2\Server\AbstractServer');
 | 
			
		||||
        $entity = new RefreshTokenEntity($server);
 | 
			
		||||
        $entity->setAccessTokenId('foobar');
 | 
			
		||||
 | 
			
		||||
        $reflector = new \ReflectionClass($entity);
 | 
			
		||||
        $accessTokenProperty = $reflector->getProperty('accessTokenId');
 | 
			
		||||
        $accessTokenProperty->setAccessible(true);
 | 
			
		||||
 | 
			
		||||
        $this->assertSame($accessTokenProperty->getValue($entity), 'foobar');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testSetAccessToken()
 | 
			
		||||
    {
 | 
			
		||||
        $server = M::mock('League\OAuth2\Server\AbstractServer');
 | 
			
		||||
@@ -17,7 +30,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
 | 
			
		||||
        $entity->setAccessToken((new AccessTokenEntity($server)));
 | 
			
		||||
 | 
			
		||||
        $reflector = new \ReflectionClass($entity);
 | 
			
		||||
        $accessTokenProperty = $reflector->getProperty('accessToken');
 | 
			
		||||
        $accessTokenProperty = $reflector->getProperty('accessTokenEntity');
 | 
			
		||||
        $accessTokenProperty->setAccessible(true);
 | 
			
		||||
 | 
			
		||||
        $this->assertTrue($accessTokenProperty->getValue($entity) instanceof AccessTokenEntity);
 | 
			
		||||
@@ -38,7 +51,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
 | 
			
		||||
 | 
			
		||||
        $accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface');
 | 
			
		||||
        $accessTokenStorage->shouldReceive('setServer');
 | 
			
		||||
        $accessTokenStorage->shouldReceive('getByRefreshToken')->andReturn(
 | 
			
		||||
        $accessTokenStorage->shouldReceive('get')->andReturn(
 | 
			
		||||
            (new AccessTokenEntity($server))->setId('foobar')
 | 
			
		||||
        );
 | 
			
		||||
        $accessTokenStorage->shouldReceive('getScopes')->andReturn([
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user