ProviderUnitTestAbstract
extends TestCase
in package
uses
HttpFactoryTrait
AbstractYes
The abstract base class for all provider tests
Table of Contents
Constants
- CACERT = self::PROJECT_ROOT . '/tests/cacert.pem'
- CFGDIR = self::PROJECT_ROOT . '/.config'
- PROJECT_ROOT = __DIR__ . '/../..'
Properties
- $ENV_IS_CI : bool
- $HTTP_CLIENT_FACTORY : string
- $logger : LoggerInterface
- $options : OAuthOptions
- $provider : OAuthInterface
- $providerFactory : OAuthProviderFactory
- $reflection : ReflectionObject
- $storage : OAuthStorageInterface
Methods
- 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__ . '/../..'
Properties
$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
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