BattleNetTest
extends OAuth2ProviderUnitTestAbstract
in package
OAuth2 unit test
Attributes
- #[Provider]
- \chillerlan\OAuth\Providers\BattleNet::class
Table of Contents
Constants
- CACERT = self::PROJECT_ROOT . '/tests/cacert.pem'
- CFGDIR = self::PROJECT_ROOT . '/.config'
- PROJECT_ROOT = __DIR__ . '/../..'
- TEST_TOKEN = '{"access_token":"2YotnFZFEjr1zCsicMWpAA","token_type":"example","expires_in":3600,' . '"refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA","example_parameter":"example_value"}'
Properties
- $provider : OAuthInterface|TokenInvalidate|UserInfo
- $provider : OAuth2Interface|ClientCredentials|CSRFToken|PAR|PKCE|TokenRefresh
- $provider : BattleNet
- $ENV_IS_CI : bool
- $HTTP_CLIENT_FACTORY : string
- $logger : LoggerInterface
- $options : OAuthOptions
- $provider : OAuthInterface
- $providerFactory : OAuthProviderFactory
- $reflection : ReflectionObject
- $storage : OAuthStorageInterface
Methods
-
arrayBodyProvider()
: array<int, array{0: array
, 1: string, 2: string}> - challengeProvider() : array<string, array{0: string, 1: string, 2: string}>
- test values from RFC-7636, Appendix B
- jsonErrorProvider() : array<string, array{0: string, 1: string}>
- requestTargetProvider() : array<string, array{0: string, 1: string}>
- testCheckCSRFState() : void
- testCheckCSRFStateEmptyException() : void
- testCheckCSRFStateMismatchException() : void
- testCheckCSRFStateNotFoundException() : void
- testCheckCSRFStateNotSupportedException() : void
- testClientCredentialsTokenRequest() : void
- testGenerateChallenge() : void
- testGetAccessToken() : void
- testGetAccessTokenRequestBodyParams() : void
- testGetAuthURL() : void
- testGetAuthURLRequestParams() : void
- testGetClientCredentialsToken() : void
- testGetClientCredentialsTokenRequestBodyParams() : void
- testGetMeResponseData() : void
- testGetParAuthURL() : void
- testGetParAuthURLErrorException() : void
- testGetRefreshAccessTokenRequestBodyParams() : void
- testGetRequestAuthorization() : void
- testGetRequestAuthorizationInvalidTokenException() : void
- testGetRequestAuthorizationWithTokenRefresh() : void
- testGetRequestBodyInvalidContentTypeForArrayException() : void
- testGetRequestBodyWithArray() : void
- testGetRequestBodyWithStreaminterface() : void
- testGetRequestBodyWithString() : void
- testGetRequestTarget() : void
- testGetRequestTargetProviderMismatchException() : void
- testHandleMeResponseErrorNoJSONContentTypeException() : void
- testHandleMeResponseErrorUnauthorizedException() : void
- testHandleMeResponseErrorWithJSONBodyException() : void
- testIdentifierIsNonEmpty() : void
- testMeResponseInvalidContentTypeException() : void
- testMeUnknownErrorException() : void
- testOAuth2Instance() : void
- testOAuthInstance() : void
- testParseTokenResponse() : void
- testParseTokenResponseErrorException() : void
- testParseTokenResponseNoDataException() : void
- testParseTokenResponseNoTokenException() : void
- testParseTokenResponseUnauthorizedException() : void
- testParseTokenResponseWithScopes() : void
- testProviderInstance() : void
- testRefreshAccessToken() : void
- testRefreshAccessTokenNoRefreshTokenException() : void
- testRefreshAccessTokenNotSupportedException() : void
- testRequest() : void
- testRequestUnauthorizedException() : void
- testSendAccessTokenRequest() : void
- testSetCodeChallengeInvalidParams() : void
- testSetCodeVerifierInvalidParams() : void
- testSetCSRFState() : void
- testSetCSRFStateNotSupportedException() : void
- testSetRegion() : void
- testSetRegionException() : void
- testTokenInvalidate() : void
- testTokenInvalidateFailed() : void
- testTokenInvalidateFailedWithException() : void
- testTokenInvalidateNoTokenException() : void
- getMockHttpClient() : ClientInterface
- Creates a stupid simple `ClientInterface` that returns the given response instance
- getProviderFQCN() : string
- Returns the fully qualified class name (FQCN) of the test subject
- getReflectionProperty() : mixed
- Returns the current value of the given propertyin the current provider instance
- getTestToken() : AccessToken
- Creates a test access token with the given parameters or a set of defaults
- initConfig() : void
- Initializes the environment config (from `phpunit.xml`)
- initOptions() : OAuthOptions
- Initializes an `OAuthOptions` instance
- initStorage() : OAuthStorageInterface
- Initializes an `OAuthStorageInterface` instance
- invokeReflectionMethod() : mixed
- Invokes a method vith the given arguments in the current provider instance
- setMockResponse() : void
- Sets a custom response in the mock http client and sets the client in the current provider
- setReflectionProperty() : void
- Sets a property in the current provider instance with the given value
- setUp() : void
- Initializes the unit test
Constants
CACERT
protected
mixed
CACERT
= self::PROJECT_ROOT . '/tests/cacert.pem'
CFGDIR
protected
mixed
CFGDIR
= self::PROJECT_ROOT . '/.config'
PROJECT_ROOT
protected
mixed
PROJECT_ROOT
= __DIR__ . '/../..'
TEST_TOKEN
protected
mixed
TEST_TOKEN
= '{"access_token":"2YotnFZFEjr1zCsicMWpAA","token_type":"example","expires_in":3600,' . '"refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA","example_parameter":"example_value"}'
Properties
$provider
public
OAuthInterface|TokenInvalidate|UserInfo
$provider
$provider
public
OAuth2Interface|ClientCredentials|CSRFToken|PAR|PKCE|TokenRefresh
$provider
$provider
public
BattleNet
$provider
$ENV_IS_CI
protected
bool
$ENV_IS_CI
$HTTP_CLIENT_FACTORY
protected
string
$HTTP_CLIENT_FACTORY
= \chillerlan\OAuthTest\Providers\ProviderUnitTestHttpClientFactory::class
$logger
protected
LoggerInterface
$logger
$options
protected
OAuthOptions
$options
$provider
protected
OAuthInterface
$provider
$providerFactory
protected
OAuthProviderFactory
$providerFactory
$reflection
protected
ReflectionObject
$reflection
$storage
protected
OAuthStorageInterface
$storage
Methods
arrayBodyProvider()
public
static arrayBodyProvider() : array<int, array{0: array, 1: string, 2: string}>
Return values
array<int, array{0: arraychallengeProvider()
test values from RFC-7636, Appendix B
public
static challengeProvider() : array<string, array{0: string, 1: string, 2: string}>
Tags
Return values
array<string, array{0: string, 1: string, 2: string}>jsonErrorProvider()
public
static jsonErrorProvider() : array<string, array{0: string, 1: string}>
Return values
array<string, array{0: string, 1: string}>requestTargetProvider()
public
static requestTargetProvider() : array<string, array{0: string, 1: string}>
Return values
array<string, array{0: string, 1: string}>testCheckCSRFState()
public
testCheckCSRFState() : void
testCheckCSRFStateEmptyException()
public
testCheckCSRFStateEmptyException() : void
testCheckCSRFStateMismatchException()
public
testCheckCSRFStateMismatchException() : void
testCheckCSRFStateNotFoundException()
public
testCheckCSRFStateNotFoundException() : void
testCheckCSRFStateNotSupportedException()
public
testCheckCSRFStateNotSupportedException() : void
testClientCredentialsTokenRequest()
public
testClientCredentialsTokenRequest() : void
testGenerateChallenge()
public
testGenerateChallenge(string $challengeMethod, string $verifier, string $expected) : void
Parameters
- $challengeMethod : string
- $verifier : string
- $expected : string
Attributes
- #[DataProvider]
- 'challengeProvider'
testGetAccessToken()
public
testGetAccessToken() : void
testGetAccessTokenRequestBodyParams()
public
testGetAccessTokenRequestBodyParams() : void
testGetAuthURL()
public
testGetAuthURL() : void
testGetAuthURLRequestParams()
public
testGetAuthURLRequestParams() : void
testGetClientCredentialsToken()
public
testGetClientCredentialsToken() : void
testGetClientCredentialsTokenRequestBodyParams()
public
testGetClientCredentialsTokenRequestBodyParams() : void
testGetMeResponseData()
public
testGetMeResponseData() : void
testGetParAuthURL()
public
testGetParAuthURL() : void
testGetParAuthURLErrorException()
public
testGetParAuthURLErrorException() : void
testGetRefreshAccessTokenRequestBodyParams()
public
testGetRefreshAccessTokenRequestBodyParams() : void
testGetRequestAuthorization()
public
testGetRequestAuthorization() : void
testGetRequestAuthorizationInvalidTokenException()
public
testGetRequestAuthorizationInvalidTokenException() : void
testGetRequestAuthorizationWithTokenRefresh()
public
testGetRequestAuthorizationWithTokenRefresh() : void
testGetRequestBodyInvalidContentTypeForArrayException()
public
testGetRequestBodyInvalidContentTypeForArrayException() : void
testGetRequestBodyWithArray()
public
testGetRequestBodyWithArray(array<string, string> $body, string $contentType, string $expected) : void
Parameters
- $body : array<string, string>
- $contentType : string
- $expected : string
Attributes
- #[DataProvider]
- 'arrayBodyProvider'
testGetRequestBodyWithStreaminterface()
public
testGetRequestBodyWithStreaminterface() : void
testGetRequestBodyWithString()
public
testGetRequestBodyWithString() : void
testGetRequestTarget()
public
testGetRequestTarget(string $path, string $expected) : void
Parameters
- $path : string
- $expected : string
Attributes
- #[DataProvider]
- 'requestTargetProvider'
testGetRequestTargetProviderMismatchException()
public
testGetRequestTargetProviderMismatchException() : void
testHandleMeResponseErrorNoJSONContentTypeException()
public
testHandleMeResponseErrorNoJSONContentTypeException() : void
testHandleMeResponseErrorUnauthorizedException()
public
testHandleMeResponseErrorUnauthorizedException() : void
testHandleMeResponseErrorWithJSONBodyException()
public
testHandleMeResponseErrorWithJSONBodyException(string $json, string $expected) : void
Parameters
- $json : string
- $expected : string
Attributes
- #[DataProvider]
- 'jsonErrorProvider'
testIdentifierIsNonEmpty()
public
testIdentifierIsNonEmpty() : void
testMeResponseInvalidContentTypeException()
public
testMeResponseInvalidContentTypeException() : void
testMeUnknownErrorException()
public
testMeUnknownErrorException() : void
testOAuth2Instance()
public
testOAuth2Instance() : void
testOAuthInstance()
public
testOAuthInstance() : void
testParseTokenResponse()
public
testParseTokenResponse() : void
testParseTokenResponseErrorException()
public
testParseTokenResponseErrorException() : void
testParseTokenResponseNoDataException()
public
testParseTokenResponseNoDataException() : void
testParseTokenResponseNoTokenException()
public
testParseTokenResponseNoTokenException() : void
testParseTokenResponseUnauthorizedException()
public
testParseTokenResponseUnauthorizedException() : void
testParseTokenResponseWithScopes()
public
testParseTokenResponseWithScopes() : void
testProviderInstance()
public
testProviderInstance() : void
testRefreshAccessToken()
public
testRefreshAccessToken() : void
testRefreshAccessTokenNoRefreshTokenException()
public
testRefreshAccessTokenNoRefreshTokenException() : void
testRefreshAccessTokenNotSupportedException()
public
testRefreshAccessTokenNotSupportedException() : void
testRequest()
public
testRequest() : void
testRequestUnauthorizedException()
public
testRequestUnauthorizedException() : void
testSendAccessTokenRequest()
public
testSendAccessTokenRequest() : void
testSetCodeChallengeInvalidParams()
public
testSetCodeChallengeInvalidParams() : void
testSetCodeVerifierInvalidParams()
public
testSetCodeVerifierInvalidParams() : void
testSetCSRFState()
public
testSetCSRFState() : void
testSetCSRFStateNotSupportedException()
public
testSetCSRFStateNotSupportedException() : void
testSetRegion()
public
testSetRegion() : void
testSetRegionException()
public
testSetRegionException() : void
testTokenInvalidate()
public
testTokenInvalidate() : void
testTokenInvalidateFailed()
public
testTokenInvalidateFailed() : void
testTokenInvalidateFailedWithException()
public
testTokenInvalidateFailedWithException() : void
testTokenInvalidateNoTokenException()
public
testTokenInvalidateNoTokenException() : void
getMockHttpClient()
Creates a stupid simple `ClientInterface` that returns the given response instance
protected
getMockHttpClient(ResponseInterface $response) : ClientInterface
Parameters
- $response : ResponseInterface
Return values
ClientInterfacegetProviderFQCN()
Returns the fully qualified class name (FQCN) of the test subject
protected
final getProviderFQCN() : string
Tags
Return values
stringgetReflectionProperty()
Returns the current value of the given propertyin the current provider instance
protected
final getReflectionProperty(string $property) : mixed
Parameters
- $property : string
getTestToken()
Creates a test access token with the given parameters or a set of defaults
protected
getTestToken([array<string, scalar|null>|null $params = null ]) : AccessToken
Parameters
- $params : array<string, scalar|null>|null = null
Return values
AccessTokeninitConfig()
Initializes the environment config (from `phpunit.xml`)
protected
initConfig() : void
initOptions()
Initializes an `OAuthOptions` instance
protected
initOptions() : OAuthOptions
Return values
OAuthOptionsinitStorage()
Initializes an `OAuthStorageInterface` instance
protected
initStorage(OAuthOptions $options) : OAuthStorageInterface
Parameters
- $options : OAuthOptions
Return values
OAuthStorageInterfaceinvokeReflectionMethod()
Invokes a method vith the given arguments in the current provider instance
protected
final invokeReflectionMethod(string $method[, array<int, mixed> $args = [] ]) : mixed
Parameters
- $method : string
- $args : array<int, mixed> = []
setMockResponse()
Sets a custom response in the mock http client and sets the client in the current provider
protected
setMockResponse(ResponseInterface|StreamInterface $response) : void
Parameters
- $response : ResponseInterface|StreamInterface
setReflectionProperty()
Sets a property in the current provider instance with the given value
protected
final setReflectionProperty(string $property, mixed $value) : void
Parameters
- $property : string
- $value : mixed
setUp()
Initializes the unit test
protected
setUp() : void