mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
Refactoring tests
This commit is contained in:
parent
a53e753b1a
commit
9ceafe5dd3
@ -106,7 +106,7 @@ class AuthorizationServerTest extends TestCase
|
|||||||
$method = $abstractGrantReflection->getMethod('getResponseType');
|
$method = $abstractGrantReflection->getMethod('getResponseType');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
$this->assertTrue($method->invoke($server) instanceof BearerTokenResponse);
|
$this->assertInstanceOf(BearerTokenResponse::class, $method->invoke($server));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompleteAuthorizationRequest()
|
public function testCompleteAuthorizationRequest()
|
||||||
@ -138,8 +138,9 @@ class AuthorizationServerTest extends TestCase
|
|||||||
$authRequest->setGrantTypeId('authorization_code');
|
$authRequest->setGrantTypeId('authorization_code');
|
||||||
$authRequest->setUser(new UserEntity());
|
$authRequest->setUser(new UserEntity());
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertInstanceOf(
|
||||||
$server->completeAuthorizationRequest($authRequest, new Response) instanceof ResponseInterface
|
ResponseInterface::class,
|
||||||
|
$server->completeAuthorizationRequest($authRequest, new Response)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +187,7 @@ class AuthorizationServerTest extends TestCase
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($server->validateAuthorizationRequest($request) instanceof AuthorizationRequest);
|
$this->assertInstanceOf(AuthorizationRequest::class, $server->validateAuthorizationRequest($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testValidateAuthorizationRequestWithMissingRedirectUri()
|
public function testValidateAuthorizationRequestWithMissingRedirectUri()
|
||||||
|
@ -342,7 +342,7 @@ class AbstractGrantTest extends TestCase
|
|||||||
$accessToken = new AccessTokenEntity();
|
$accessToken = new AccessTokenEntity();
|
||||||
/** @var RefreshTokenEntityInterface $refreshToken */
|
/** @var RefreshTokenEntityInterface $refreshToken */
|
||||||
$refreshToken = $issueRefreshTokenMethod->invoke($grantMock, $accessToken);
|
$refreshToken = $issueRefreshTokenMethod->invoke($grantMock, $accessToken);
|
||||||
$this->assertTrue($refreshToken instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $refreshToken);
|
||||||
$this->assertEquals($accessToken, $refreshToken->getAccessToken());
|
$this->assertEquals($accessToken, $refreshToken->getAccessToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ class AbstractGrantTest extends TestCase
|
|||||||
123,
|
123,
|
||||||
[new ScopeEntity()]
|
[new ScopeEntity()]
|
||||||
);
|
);
|
||||||
$this->assertTrue($accessToken instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $accessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIssueAuthCode()
|
public function testIssueAuthCode()
|
||||||
@ -383,7 +383,8 @@ class AbstractGrantTest extends TestCase
|
|||||||
$issueAuthCodeMethod = $abstractGrantReflection->getMethod('issueAuthCode');
|
$issueAuthCodeMethod = $abstractGrantReflection->getMethod('issueAuthCode');
|
||||||
$issueAuthCodeMethod->setAccessible(true);
|
$issueAuthCodeMethod->setAccessible(true);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertInstanceOf(
|
||||||
|
AuthCodeEntityInterface::class,
|
||||||
$issueAuthCodeMethod->invoke(
|
$issueAuthCodeMethod->invoke(
|
||||||
$grantMock,
|
$grantMock,
|
||||||
new \DateInterval('PT1H'),
|
new \DateInterval('PT1H'),
|
||||||
@ -391,7 +392,7 @@ class AbstractGrantTest extends TestCase
|
|||||||
123,
|
123,
|
||||||
'http://foo/bar',
|
'http://foo/bar',
|
||||||
[new ScopeEntity()]
|
[new ScopeEntity()]
|
||||||
) instanceof AuthCodeEntityInterface
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +468,7 @@ class AbstractGrantTest extends TestCase
|
|||||||
$method = $abstractGrantReflection->getMethod('generateUniqueIdentifier');
|
$method = $abstractGrantReflection->getMethod('generateUniqueIdentifier');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
$this->assertTrue(is_string($method->invoke($grantMock)));
|
$this->assertInternalType('string', $method->invoke($grantMock));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCanRespondToAuthorizationRequest()
|
public function testCanRespondToAuthorizationRequest()
|
||||||
|
@ -111,7 +111,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($grant->validateAuthorizationRequest($request) instanceof AuthorizationRequest);
|
$this->assertInstanceOf(AuthorizationRequest::class, $grant->validateAuthorizationRequest($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testValidateAuthorizationRequestRedirectUriArray()
|
public function testValidateAuthorizationRequestRedirectUriArray()
|
||||||
@ -149,7 +149,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($grant->validateAuthorizationRequest($request) instanceof AuthorizationRequest);
|
$this->assertInstanceOf(AuthorizationRequest::class, $grant->validateAuthorizationRequest($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testValidateAuthorizationRequestCodeChallenge()
|
public function testValidateAuthorizationRequestCodeChallenge()
|
||||||
@ -189,7 +189,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($grant->validateAuthorizationRequest($request) instanceof AuthorizationRequest);
|
$this->assertInstanceOf(AuthorizationRequest::class, $grant->validateAuthorizationRequest($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -545,7 +545,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
);
|
);
|
||||||
$grant->setEncryptionKey($this->cryptStub->getKey());
|
$grant->setEncryptionKey($this->cryptStub->getKey());
|
||||||
|
|
||||||
$this->assertTrue($grant->completeAuthorizationRequest($authRequest) instanceof RedirectResponse);
|
$this->assertInstanceOf(RedirectResponse::class, $grant->completeAuthorizationRequest($authRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -636,8 +636,8 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
/** @var StubResponseType $response */
|
/** @var StubResponseType $response */
|
||||||
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
||||||
|
|
||||||
$this->assertTrue($response->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $response->getAccessToken());
|
||||||
$this->assertTrue($response->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $response->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRespondToAccessTokenRequestCodeChallengePlain()
|
public function testRespondToAccessTokenRequestCodeChallengePlain()
|
||||||
@ -707,8 +707,8 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
/** @var StubResponseType $response */
|
/** @var StubResponseType $response */
|
||||||
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
||||||
|
|
||||||
$this->assertTrue($response->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $response->getAccessToken());
|
||||||
$this->assertTrue($response->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $response->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRespondToAccessTokenRequestCodeChallengeS256()
|
public function testRespondToAccessTokenRequestCodeChallengeS256()
|
||||||
@ -778,8 +778,8 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
/** @var StubResponseType $response */
|
/** @var StubResponseType $response */
|
||||||
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
||||||
|
|
||||||
$this->assertTrue($response->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $response->getAccessToken());
|
||||||
$this->assertTrue($response->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $response->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1390,7 +1390,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
);
|
);
|
||||||
$grant->setEncryptionKey($this->cryptStub->getKey());
|
$grant->setEncryptionKey($this->cryptStub->getKey());
|
||||||
|
|
||||||
$this->assertTrue($grant->completeAuthorizationRequest($authRequest) instanceof RedirectResponse);
|
$this->assertInstanceOf(RedirectResponse::class, $grant->completeAuthorizationRequest($authRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1416,7 +1416,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
);
|
);
|
||||||
$grant->setEncryptionKey($this->cryptStub->getKey());
|
$grant->setEncryptionKey($this->cryptStub->getKey());
|
||||||
|
|
||||||
$this->assertTrue($grant->completeAuthorizationRequest($authRequest) instanceof RedirectResponse);
|
$this->assertInstanceOf(RedirectResponse::class, $grant->completeAuthorizationRequest($authRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1441,7 +1441,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
new \DateInterval('PT10M')
|
new \DateInterval('PT10M')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($grant->completeAuthorizationRequest($authRequest) instanceof RedirectResponse);
|
$this->assertInstanceOf(RedirectResponse::class, $grant->completeAuthorizationRequest($authRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRefreshTokenRepositoryUniqueConstraintCheck()
|
public function testRefreshTokenRepositoryUniqueConstraintCheck()
|
||||||
@ -1508,8 +1508,8 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
/** @var StubResponseType $response */
|
/** @var StubResponseType $response */
|
||||||
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
||||||
|
|
||||||
$this->assertTrue($response->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $response->getAccessToken());
|
||||||
$this->assertTrue($response->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $response->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1579,8 +1579,8 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
/** @var StubResponseType $response */
|
/** @var StubResponseType $response */
|
||||||
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
||||||
|
|
||||||
$this->assertTrue($response->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $response->getAccessToken());
|
||||||
$this->assertTrue($response->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $response->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1650,8 +1650,8 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
/** @var StubResponseType $response */
|
/** @var StubResponseType $response */
|
||||||
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
$response = $grant->respondToAccessTokenRequest($request, new StubResponseType(), new \DateInterval('PT10M'));
|
||||||
|
|
||||||
$this->assertTrue($response->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $response->getAccessToken());
|
||||||
$this->assertTrue($response->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $response->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ class ClientCredentialsGrantTest extends TestCase
|
|||||||
$responseType = new StubResponseType();
|
$responseType = new StubResponseType();
|
||||||
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
||||||
|
|
||||||
$this->assertTrue($responseType->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $responseType->getAccessToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,7 +116,7 @@ class ImplicitGrantTest extends TestCase
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($grant->validateAuthorizationRequest($request) instanceof AuthorizationRequest);
|
$this->assertInstanceOf(AuthorizationRequest::class, $grant->validateAuthorizationRequest($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testValidateAuthorizationRequestRedirectUriArray()
|
public function testValidateAuthorizationRequestRedirectUriArray()
|
||||||
@ -151,7 +151,7 @@ class ImplicitGrantTest extends TestCase
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue($grant->validateAuthorizationRequest($request) instanceof AuthorizationRequest);
|
$this->assertInstanceOf(AuthorizationRequest::class, $grant->validateAuthorizationRequest($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -290,7 +290,7 @@ class ImplicitGrantTest extends TestCase
|
|||||||
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
|
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
|
||||||
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
|
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
|
||||||
|
|
||||||
$this->assertTrue($grant->completeAuthorizationRequest($authRequest) instanceof RedirectResponse);
|
$this->assertInstanceOf(RedirectResponse::class, $grant->completeAuthorizationRequest($authRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -334,7 +334,7 @@ class ImplicitGrantTest extends TestCase
|
|||||||
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
|
$grant->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
|
||||||
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
|
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
|
||||||
|
|
||||||
$this->assertTrue($grant->completeAuthorizationRequest($authRequest) instanceof RedirectResponse);
|
$this->assertInstanceOf(RedirectResponse::class, $grant->completeAuthorizationRequest($authRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,8 +74,8 @@ class PasswordGrantTest extends TestCase
|
|||||||
$responseType = new StubResponseType();
|
$responseType = new StubResponseType();
|
||||||
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
||||||
|
|
||||||
$this->assertTrue($responseType->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $responseType->getAccessToken());
|
||||||
$this->assertTrue($responseType->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $responseType->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,8 +90,8 @@ class RefreshTokenGrantTest extends TestCase
|
|||||||
$responseType = new StubResponseType();
|
$responseType = new StubResponseType();
|
||||||
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
||||||
|
|
||||||
$this->assertTrue($responseType->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $responseType->getAccessToken());
|
||||||
$this->assertTrue($responseType->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $responseType->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRespondToReducedScopes()
|
public function testRespondToReducedScopes()
|
||||||
@ -147,8 +147,8 @@ class RefreshTokenGrantTest extends TestCase
|
|||||||
$responseType = new StubResponseType();
|
$responseType = new StubResponseType();
|
||||||
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
$grant->respondToAccessTokenRequest($serverRequest, $responseType, new \DateInterval('PT5M'));
|
||||||
|
|
||||||
$this->assertTrue($responseType->getAccessToken() instanceof AccessTokenEntityInterface);
|
$this->assertInstanceOf(AccessTokenEntityInterface::class, $responseType->getAccessToken());
|
||||||
$this->assertTrue($responseType->getRefreshToken() instanceof RefreshTokenEntityInterface);
|
$this->assertInstanceOf(RefreshTokenEntityInterface::class, $responseType->getRefreshToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ class BearerResponseTypeTest extends TestCase
|
|||||||
|
|
||||||
$response = $responseType->generateHttpResponse(new Response());
|
$response = $responseType->generateHttpResponse(new Response());
|
||||||
|
|
||||||
$this->assertTrue($response instanceof ResponseInterface);
|
$this->assertInstanceOf(ResponseInterface::class, $response);
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$this->assertEquals('no-cache', $response->getHeader('pragma')[0]);
|
$this->assertEquals('no-cache', $response->getHeader('pragma')[0]);
|
||||||
$this->assertEquals('no-store', $response->getHeader('cache-control')[0]);
|
$this->assertEquals('no-store', $response->getHeader('cache-control')[0]);
|
||||||
@ -56,10 +56,10 @@ class BearerResponseTypeTest extends TestCase
|
|||||||
|
|
||||||
$response->getBody()->rewind();
|
$response->getBody()->rewind();
|
||||||
$json = json_decode($response->getBody()->getContents());
|
$json = json_decode($response->getBody()->getContents());
|
||||||
$this->assertEquals('Bearer', $json->token_type);
|
$this->assertAttributeEquals('Bearer', 'token_type', $json);
|
||||||
$this->assertTrue(isset($json->expires_in));
|
$this->assertObjectHasAttribute('expires_in', $json);
|
||||||
$this->assertTrue(isset($json->access_token));
|
$this->assertObjectHasAttribute('access_token', $json);
|
||||||
$this->assertTrue(isset($json->refresh_token));
|
$this->assertObjectHasAttribute('refresh_token', $json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGenerateHttpResponseWithExtraParams()
|
public function testGenerateHttpResponseWithExtraParams()
|
||||||
@ -92,7 +92,7 @@ class BearerResponseTypeTest extends TestCase
|
|||||||
|
|
||||||
$response = $responseType->generateHttpResponse(new Response());
|
$response = $responseType->generateHttpResponse(new Response());
|
||||||
|
|
||||||
$this->assertTrue($response instanceof ResponseInterface);
|
$this->assertInstanceOf(ResponseInterface::class, $response);
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
$this->assertEquals('no-cache', $response->getHeader('pragma')[0]);
|
$this->assertEquals('no-cache', $response->getHeader('pragma')[0]);
|
||||||
$this->assertEquals('no-store', $response->getHeader('cache-control')[0]);
|
$this->assertEquals('no-store', $response->getHeader('cache-control')[0]);
|
||||||
@ -100,13 +100,13 @@ class BearerResponseTypeTest extends TestCase
|
|||||||
|
|
||||||
$response->getBody()->rewind();
|
$response->getBody()->rewind();
|
||||||
$json = json_decode($response->getBody()->getContents());
|
$json = json_decode($response->getBody()->getContents());
|
||||||
$this->assertEquals('Bearer', $json->token_type);
|
$this->assertAttributeEquals('Bearer', 'token_type', $json);
|
||||||
$this->assertTrue(isset($json->expires_in));
|
$this->assertObjectHasAttribute('expires_in', $json);
|
||||||
$this->assertTrue(isset($json->access_token));
|
$this->assertObjectHasAttribute('access_token', $json);
|
||||||
$this->assertTrue(isset($json->refresh_token));
|
$this->assertObjectHasAttribute('refresh_token', $json);
|
||||||
|
|
||||||
$this->assertTrue(isset($json->foo));
|
$this->assertObjectHasAttribute('foo', $json);
|
||||||
$this->assertEquals('bar', $json->foo);
|
$this->assertAttributeEquals('bar', 'foo', $json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDetermineAccessTokenInHeaderValidToken()
|
public function testDetermineAccessTokenInHeaderValidToken()
|
||||||
|
Loading…
Reference in New Issue
Block a user