IdentityRepositoryTest
extends AbstractTokenRepositoryTestCase
in package
OAuth2 IdentityRepository tests.
Tags
Table of Contents
- $accessTokenTable : mixed
- $oauth2Config : array<string|int, mixed>
- OAuth2 configuration
- $userBirthDate : string
- User's birth date
- getTestIdentityRepositoryData() : array<string|int, mixed>
- Data provider for testIdentityRepository
- setUp() : void
- Setup tests
- testIdentityRepository() : void
- Test identity repository
- testIdentityRepositoryWithFailingILS() : void
- Test identity repository with a failing ILS connection
- createAccessTokenRow() : MockObject|AccessToken
- Create AccessToken row
- createClientEntity() : ClientEntity
- Create a client entity
- createExpiryDateTime() : DateTimeImmutable
- Create an expiry datetime.
- createTokenId() : string
- Create a token ID.
- createUserRow() : MockObject|User
- Create User row
- getAccessTokenRepository() : AccessTokenRepository
- Create AccessTokenRepository with mocks.
- getAuthCodeRepository() : AuthCodeRepository
- Create AuthCodeRepository with mocks.
- getCatUsernameHash() : string
- Create a hash from a user name
- getMockAccessTokenService() : MockObject|AccessTokenServiceInterface
- Create Access token service
- getMockAccessTokenTable() : MockObject|AccessToken
- Create AccessToken table
- getMockFailingIlsConnection() : MockObject|Connection
- Get mock ILS connection that throws an exception for any actual ILS request.
- getMockILSAuthenticator() : ILSAuthenticator
- Get a mock ILSAuthenticator
- getMockIlsConnection() : MockObject|Connection
- Get mock ILS connection.
- getMockUser() : MockObject|UserEntityInterface
- Get a mock user object
- getMockUserService() : MockObject|UserServiceInterface
- Create a mock user service that returns a fake user object.
- getMockUserTable() : MockObject|User
- Create User table
- getOAuth2Config() : array<string|int, mixed>
- Create OAuth2 Config
- getRefreshTokenRepository() : RefreshTokenRepository
- Create RefreshTokenRepository with mocks.
Properties
$accessTokenTable
protected
mixed
$accessTokenTable
= []
$oauth2Config
OAuth2 configuration
protected
array<string|int, mixed>
$oauth2Config
= ['Server' => ['userIdentifierField' => 'id', 'encryptionKey' => 'testkey', 'hashSalt' => 'superSalty'], 'ClaimMappings' => ['id' => 'id', 'sub' => 'id', 'nonce' => 'nonce', 'name' => 'full_name', 'given_name' => 'firstname', 'family_name' => 'lastname', 'email' => 'email', 'age' => 'age', 'birthdate' => 'birthdate', 'locale' => 'last_language', 'phone' => 'phone', 'address' => 'address_json', 'block_status' => 'block_status', 'library_user_id' => 'library_user_id_hash']]
$userBirthDate
User's birth date
protected
string
$userBirthDate
Methods
getTestIdentityRepositoryData()
Data provider for testIdentityRepository
public
static getTestIdentityRepositoryData() : array<string|int, mixed>
Return values
array<string|int, mixed> —setUp()
Setup tests
public
setUp() : void
Return values
void —testIdentityRepository()
Test identity repository
public
testIdentityRepository(bool|null $blocks) : void
Parameters
- $blocks : bool|null
-
Blocks status
Tags
Return values
void —testIdentityRepositoryWithFailingILS()
Test identity repository with a failing ILS connection
public
testIdentityRepositoryWithFailingILS() : void
Return values
void —createAccessTokenRow()
Create AccessToken row
protected
createAccessTokenRow(array<string|int, mixed> $data) : MockObject|AccessToken
Parameters
- $data : array<string|int, mixed>
-
Row data
Return values
MockObject|AccessToken —createClientEntity()
Create a client entity
protected
createClientEntity() : ClientEntity
Return values
ClientEntity —createExpiryDateTime()
Create an expiry datetime.
protected
createExpiryDateTime() : DateTimeImmutable
Return values
DateTimeImmutable —createTokenId()
Create a token ID.
protected
createTokenId() : string
Follows OAuth2 server's generateUniqueIdentifier.
Return values
string —createUserRow()
Create User row
protected
createUserRow(array<string|int, mixed> $data) : MockObject|User
Parameters
- $data : array<string|int, mixed>
-
Row data
Return values
MockObject|User —getAccessTokenRepository()
Create AccessTokenRepository with mocks.
protected
getAccessTokenRepository() : AccessTokenRepository
Return values
AccessTokenRepository —getAuthCodeRepository()
Create AuthCodeRepository with mocks.
protected
getAuthCodeRepository() : AuthCodeRepository
Return values
AuthCodeRepository —getCatUsernameHash()
Create a hash from a user name
protected
getCatUsernameHash(string $username) : string
Parameters
- $username : string
-
User name
Return values
string —getMockAccessTokenService()
Create Access token service
protected
getMockAccessTokenService() : MockObject|AccessTokenServiceInterface
Return values
MockObject|AccessTokenServiceInterface —getMockAccessTokenTable()
Create AccessToken table
protected
getMockAccessTokenTable() : MockObject|AccessToken
Return values
MockObject|AccessToken —getMockFailingIlsConnection()
Get mock ILS connection that throws an exception for any actual ILS request.
protected
getMockFailingIlsConnection() : MockObject|Connection
Return values
MockObject|Connection —getMockILSAuthenticator()
Get a mock ILSAuthenticator
protected
getMockILSAuthenticator() : ILSAuthenticator
Tags
Return values
ILSAuthenticator —getMockIlsConnection()
Get mock ILS connection.
protected
getMockIlsConnection(bool|null $blocks) : MockObject|Connection
Parameters
- $blocks : bool|null
-
Whether to support blocks and what to return
Return values
MockObject|Connection —getMockUser()
Get a mock user object
protected
getMockUser() : MockObject|UserEntityInterface
Return values
MockObject|UserEntityInterface —getMockUserService()
Create a mock user service that returns a fake user object.
protected
getMockUserService() : MockObject|UserServiceInterface
Return values
MockObject|UserServiceInterface —getMockUserTable()
Create User table
protected
getMockUserTable() : MockObject|User
Return values
MockObject|User —getOAuth2Config()
Create OAuth2 Config
protected
getOAuth2Config() : array<string|int, mixed>
Return values
array<string|int, mixed> —getRefreshTokenRepository()
Create RefreshTokenRepository with mocks.
protected
getRefreshTokenRepository() : RefreshTokenRepository