ILSTest
extends TestCase
in package
Uses
ConfigPluginManagerTrait, LiveDatabaseTrait, LiveDetectionTrait
ILS authentication test class.
Class must be final due to use of "new static()" by LiveDatabaseTrait.
Tags
Table of Contents
- $hasLiveDatabaseTrait : bool
- Flag to allow other traits to test for the presence of this one (to enforce dependencies).
- $hasLiveDetectionTrait : bool
- Flag to allow other traits to test for the presence of this one (to enforce dependencies).
- $liveDatabaseContainer : MockContainer|null
- Container connected to live database.
- continuousIntegrationRunning() : bool
- Is this test running in a continuous integration context?
- getDbService() : DbServiceInterface
- Get a database service.
- getFavoritesService() : FavoritesService
- Get the favorites service.
- getLiveDatabaseContainer() : MockContainer
- Get a real, working table manager.
- getLiveDbServiceManager() : PluginManager
- Get a real, working database service manager.
- getLiveTableManager() : PluginManager
- Get a real, working table manager.
- getTable() : Gateway
- Get a table object.
- setUp() : void
- Standard setup method.
- setUpBeforeClass() : void
- Standard setup method.
- tearDownAfterClass() : void
- Standard teardown method.
- testBadLoginResponse() : void
- Test login with technical error.
- testCreateIsDisallowed() : void
- Test account creation is disallowed.
- testLogin() : void
- Test successful login.
- testLoginWithBlankPassword() : void
- Test login with blank password.
- testLoginWithBlankUsername() : void
- Test login with blank username.
- testLoginWithMissingCatId() : void
- Test failure caused by missing cat_id.
- testUpdateUserPassword() : void
- Test updating a user's password.
- testUpdateUserPasswordUsingCatIdField() : void
- Test updating a user's password (identifying user with cat_id field).
- testUpdateUserPasswordWithEmptyValue() : void
- Test updating a user's password with mismatched new password values.
- testUpdateUserPasswordWithMismatch() : void
- Test updating a user's password with mismatched new password values.
- testUpdateUserPasswordWithoutLoggedInUser() : void
- Test updating a user's password with mismatched new password values.
- failIfDataExists() : void
- Static setup support function to fail if there is already data in the database. We want to ensure a clean state for each test!
- getAuth() : ILS
- Get the object to test.
- getLoginRequest() : Request
- Support method -- get parameters to log into an account (but allow override of individual parameters so we can test different scenarios).
- getMockConfigPluginManager() : MockObject|PluginManager
- Get a mock configuration plugin manager with the given configuration "files" available.
- getMockDriver() : Sample
- Get a mock ILS driver to test.
- getMockFailingConfigPluginManager() : MockObject|PluginManager
- Get a mock configuration plugin manager that will throw an exception.
- getMockILSAuthenticator() : ILSAuthenticator
- Get mock ILS authenticator
- removeUsers() : void
- Static teardown support function to destroy user accounts. Accounts are expected to exist, and the method will fail if they are missing.
Properties
$hasLiveDatabaseTrait
Flag to allow other traits to test for the presence of this one (to enforce dependencies).
public
bool
$hasLiveDatabaseTrait
= true
$hasLiveDetectionTrait
Flag to allow other traits to test for the presence of this one (to enforce dependencies).
public
bool
$hasLiveDetectionTrait
= true
$liveDatabaseContainer
Container connected to live database.
protected
MockContainer|null
$liveDatabaseContainer
= null
Methods
continuousIntegrationRunning()
Is this test running in a continuous integration context?
public
continuousIntegrationRunning() : bool
Return values
bool —getDbService()
Get a database service.
public
getDbService(string $service) : DbServiceInterface
Parameters
- $service : string
-
Name of service to load
Return values
DbServiceInterface —getFavoritesService()
Get the favorites service.
public
getFavoritesService() : FavoritesService
Return values
FavoritesService —getLiveDatabaseContainer()
Get a real, working table manager.
public
getLiveDatabaseContainer() : MockContainer
Return values
MockContainer —getLiveDbServiceManager()
Get a real, working database service manager.
public
getLiveDbServiceManager() : PluginManager
Return values
PluginManager —getLiveTableManager()
Get a real, working table manager.
public
getLiveTableManager() : PluginManager
Return values
PluginManager —getTable()
Get a table object.
public
getTable(string $table) : Gateway
Parameters
- $table : string
-
Name of table to load
Return values
Gateway —setUp()
Standard setup method.
public
setUp() : void
Return values
void —setUpBeforeClass()
Standard setup method.
public
static setUpBeforeClass() : void
Return values
void —tearDownAfterClass()
Standard teardown method.
public
static tearDownAfterClass() : void
Return values
void —testBadLoginResponse()
Test login with technical error.
public
testBadLoginResponse() : void
Return values
void —testCreateIsDisallowed()
Test account creation is disallowed.
public
testCreateIsDisallowed() : void
Return values
void —testLogin()
Test successful login.
public
testLogin() : void
Return values
void —testLoginWithBlankPassword()
Test login with blank password.
public
testLoginWithBlankPassword() : void
Return values
void —testLoginWithBlankUsername()
Test login with blank username.
public
testLoginWithBlankUsername() : void
Return values
void —testLoginWithMissingCatId()
Test failure caused by missing cat_id.
public
testLoginWithMissingCatId() : void
Return values
void —testUpdateUserPassword()
Test updating a user's password.
public
testUpdateUserPassword() : void
Return values
void —testUpdateUserPasswordUsingCatIdField()
Test updating a user's password (identifying user with cat_id field).
public
testUpdateUserPasswordUsingCatIdField() : void
Return values
void —testUpdateUserPasswordWithEmptyValue()
Test updating a user's password with mismatched new password values.
public
testUpdateUserPasswordWithEmptyValue() : void
Return values
void —testUpdateUserPasswordWithMismatch()
Test updating a user's password with mismatched new password values.
public
testUpdateUserPasswordWithMismatch() : void
Return values
void —testUpdateUserPasswordWithoutLoggedInUser()
Test updating a user's password with mismatched new password values.
public
testUpdateUserPasswordWithoutLoggedInUser() : void
Return values
void —failIfDataExists()
Static setup support function to fail if there is already data in the database. We want to ensure a clean state for each test!
protected
static failIfDataExists([string|null $failMessage = null ]) : void
Parameters
- $failMessage : string|null = null
-
Failure message to display if data exists (null for default).
Return values
void —getAuth()
Get the object to test.
protected
getAuth([AbstractBase $driver = null ][, array<string|int, mixed> $patron = null ]) : ILS
Parameters
- $driver : AbstractBase = null
-
Mock ILS driver to test with.
- $patron : array<string|int, mixed> = null
-
Logged in patron for mock authenticator (null for none)
Return values
ILS —getLoginRequest()
Support method -- get parameters to log into an account (but allow override of individual parameters so we can test different scenarios).
protected
getLoginRequest([array<string|int, mixed> $overrides = [] ]) : Request
Parameters
- $overrides : array<string|int, mixed> = []
-
Associative array of parameters to override.
Return values
Request —getMockConfigPluginManager()
Get a mock configuration plugin manager with the given configuration "files" available.
protected
getMockConfigPluginManager(array<string|int, mixed> $configs[, array<string|int, mixed> $default = [] ][, InvocationOrder|null $getExpect = null ][, InvocationOrder|null $hasExpect = null ]) : MockObject|PluginManager
Parameters
- $configs : array<string|int, mixed>
-
An associative array of configurations where key is the file (e.g. 'config') and value an array of configuration sections and directives
- $default : array<string|int, mixed> = []
-
Default configuration to return when no entry is found in $configs
- $getExpect : InvocationOrder|null = null
-
The expected invocation order for the get() method (null for any)
- $hasExpect : InvocationOrder|null = null
-
The expected invocation order for the has() method (null for any)
Return values
MockObject|PluginManager —getMockDriver()
Get a mock ILS driver to test.
protected
getMockDriver([string $type = 'Sample' ][, array<string|int, mixed> $methods = ['patronLogin'] ]) : Sample
Parameters
- $type : string = 'Sample'
-
Driver type to mock (default = Sample)
- $methods : array<string|int, mixed> = ['patronLogin']
-
Methods to mock
Return values
Sample —getMockFailingConfigPluginManager()
Get a mock configuration plugin manager that will throw an exception.
protected
getMockFailingConfigPluginManager(Throwable $exception) : MockObject|PluginManager
Parameters
- $exception : Throwable
-
Exception to throw
Return values
MockObject|PluginManager —getMockILSAuthenticator()
Get mock ILS authenticator
protected
getMockILSAuthenticator([array<string|int, mixed> $patron = null ]) : ILSAuthenticator
Parameters
- $patron : array<string|int, mixed> = null
-
Logged in patron to simulate (null for none).
Return values
ILSAuthenticator —removeUsers()
Static teardown support function to destroy user accounts. Accounts are expected to exist, and the method will fail if they are missing.
protected
static removeUsers(array<string|int, string>|string $users) : void
Parameters
- $users : array<string|int, string>|string
-
User(s) to delete