Documentation

SteamTest extends OAuthProviderUnitTestAbstract
in package

FinalYes

abstract OAuth unit test

Attributes
#[Provider]
\chillerlan\OAuth\Providers\Steam::class

Table of Contents

Constants

CACERT  = self::PROJECT_ROOT . '/tests/cacert.pem'
CFGDIR  = self::PROJECT_ROOT . '/.config'
ID_INVALID  = "ns:http://specs.openid.net/auth/2.0\nis_valid:false\n"
ID_VALID  = "ns:http://specs.openid.net/auth/2.0\nis_valid:true\n"
OPENID_CALLBACK  = ['openid_ns' => 'http://specs.openid.net/auth/2.0', 'openid_mode' => 'id_res', 'openid_op_endpoint' => 'https://steamcommunity.com/openid/login', 'openid_claimed_id' => 'https://steamcommunity.com/openid/id/69420', 'openid_identity' => 'https://steamcommunity.com/openid/id/69420', 'openid_return_to' => 'https://smiley.codes/oauth/', 'openid_response_nonce' => '2021-03-16T06:40:46ZtLLZ4JqhLZ2IULBg8x2P8YitHQY=', 'openid_assoc_handle' => '1234567890', 'openid_signed' => 'signed,op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle', 'openid_sig' => '7WEtj64YlaJLNqL6M0gZvVmOLFg=']
PROJECT_ROOT  = __DIR__ . '/../..'

Properties

$provider  : OAuthInterface|TokenInvalidate|UserInfo
$provider  : Steam
$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}>
jsonErrorProvider()  : array<string, array{0: string, 1: string}>
requestTargetProvider()  : array<string, array{0: string, 1: string}>
testGetAccessToken()  : void
testGetAccessTokenRequestBodyParams()  : void
testGetAuthURL()  : void
testGetMeResponseData()  : void
testGetRequestAuthorizationInvalidTokenException()  : 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
testOAuthInstance()  : void
testParseAccessTokenResponse()  : void
testParseTokenResponseInvalidIdException()  : void
testParseTokenResponseNoDataException()  : void
testProviderInstance()  : void
testRequest()  : void
testRequestUnauthorizedException()  : 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

ID_INVALID

protected mixed ID_INVALID = "ns:http://specs.openid.net/auth/2.0\nis_valid:false\n"

ID_VALID

protected mixed ID_VALID = "ns:http://specs.openid.net/auth/2.0\nis_valid:true\n"

OPENID_CALLBACK

protected mixed OPENID_CALLBACK = ['openid_ns' => 'http://specs.openid.net/auth/2.0', 'openid_mode' => 'id_res', 'openid_op_endpoint' => 'https://steamcommunity.com/openid/login', 'openid_claimed_id' => 'https://steamcommunity.com/openid/id/69420', 'openid_identity' => 'https://steamcommunity.com/openid/id/69420', 'openid_return_to' => 'https://smiley.codes/oauth/', 'openid_response_nonce' => '2021-03-16T06:40:46ZtLLZ4JqhLZ2IULBg8x2P8YitHQY=', 'openid_assoc_handle' => '1234567890', 'openid_signed' => 'signed,op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle', 'openid_sig' => '7WEtj64YlaJLNqL6M0gZvVmOLFg=']

Properties

$HTTP_CLIENT_FACTORY

protected string $HTTP_CLIENT_FACTORY = \chillerlan\OAuthTest\Providers\ProviderUnitTestHttpClientFactory::class

Methods

arrayBodyProvider()

public static arrayBodyProvider() : array<int, array{0: array, 1: string, 2: string}>
Return values
array<int, array{0: array, 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}>

testGetAccessToken()

public testGetAccessToken() : void

testGetAccessTokenRequestBodyParams()

public testGetAccessTokenRequestBodyParams() : void

testGetAuthURL()

public testGetAuthURL() : void

testGetRequestAuthorizationInvalidTokenException()

public testGetRequestAuthorizationInvalidTokenException() : 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'

testGetRequestTarget()

public testGetRequestTarget(string $path, string $expected) : void
Parameters
$path : string
$expected : string
Attributes
#[DataProvider]
'requestTargetProvider'

testHandleMeResponseErrorWithJSONBodyException()

public testHandleMeResponseErrorWithJSONBodyException(string $json, string $expected) : void
Parameters
$json : string
$expected : string
Attributes
#[DataProvider]
'jsonErrorProvider'

testParseAccessTokenResponse()

public testParseAccessTokenResponse() : void

testParseTokenResponseInvalidIdException()

public testParseTokenResponseInvalidIdException() : void

testParseTokenResponseNoDataException()

public testParseTokenResponseNoDataException() : void

getMockHttpClient()

Creates a stupid simple `ClientInterface` that returns the given response instance

protected getMockHttpClient(ResponseInterface $response) : ClientInterface
Parameters
$response : ResponseInterface
Return values
ClientInterface

getProviderFQCN()

Returns the fully qualified class name (FQCN) of the test subject

protected final getProviderFQCN() : string
Tags
see
Provider
Return values
string

getReflectionProperty()

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
AccessToken

invokeReflectionMethod()

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

        
On this page

Search results