VuFind API Documentation

DatabaseTest extends TestCase
in package
Uses LiveDatabaseTrait, LiveDetectionTrait

Database authentication test class.

Class must be final due to use of "new static()" by LiveDatabaseTrait.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Page

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).
$auth  : Database
Object to test
$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.
testCreateIsAllowed()  : void
Test account creation is allowed.
testCreationWithBlankPassword()  : void
Test blank password.
testCreationWithBlankUsername()  : void
Test blank username.
testCreationWithDuplicateEmail()  : void
Test duplicate email.
testCreationWithDuplicateUsername()  : void
Test duplicate username.
testCreationWithInvalidEmail()  : void
Test invalid email.
testCreationWithPasswordMismatch()  : void
Test password mismatch.
testLogin()  : void
Test successful login.
testLoginWithBadPassword()  : void
Test login with bad password.
testLoginWithBlankPassword()  : void
Test login with blank password.
testLoginWithBlankUsername()  : void
Test login with blank username.
testLoginWithUnrecognizedUsername()  : void
Test login with unknown username.
testSuccessfulCreation()  : void
Test successful account creation.
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!
getAccountCreationRequest()  : Request
Support method -- get parameters to create an account (but allow override of individual parameters so we can test different scenarios).
getLoginRequest()  : Request
Support method -- get parameters to log into an account (but allow override of individual parameters so we can test different scenarios).
getRequest()  : Request
Support method -- turn an array into a request populated for use by the authentication class.
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

Methods

continuousIntegrationRunning()

Is this test running in a continuous integration context?

public continuousIntegrationRunning() : bool
Return values
bool

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

testCreateIsAllowed()

Test account creation is allowed.

public testCreateIsAllowed() : void
Return values
void

testCreationWithBlankPassword()

Test blank password.

public testCreationWithBlankPassword() : void
Return values
void

testCreationWithBlankUsername()

Test blank username.

public testCreationWithBlankUsername() : void
Return values
void

testCreationWithDuplicateEmail()

Test duplicate email.

public testCreationWithDuplicateEmail() : void
Return values
void

testCreationWithDuplicateUsername()

Test duplicate username.

public testCreationWithDuplicateUsername() : void
Return values
void

testCreationWithInvalidEmail()

Test invalid email.

public testCreationWithInvalidEmail() : void
Return values
void

testCreationWithPasswordMismatch()

Test password mismatch.

public testCreationWithPasswordMismatch() : void
Return values
void

testLogin()

Test successful login.

public testLogin() : void
Return values
void

testLoginWithBadPassword()

Test login with bad password.

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

testLoginWithUnrecognizedUsername()

Test login with unknown username.

public testLoginWithUnrecognizedUsername() : void
Return values
void

testSuccessfulCreation()

Test successful account creation.

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

getAccountCreationRequest()

Support method -- get parameters to create an account (but allow override of individual parameters so we can test different scenarios).

protected getAccountCreationRequest([array<string|int, mixed> $overrides = [] ]) : Request
Parameters
$overrides : array<string|int, mixed> = []

Associative array of parameters to override.

Return values
Request

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

getRequest()

Support method -- turn an array into a request populated for use by the authentication class.

protected getRequest(array<string|int, mixed> $post) : Request
Parameters
$post : array<string|int, mixed>

Associative array of POST parameters.

Return values
Request

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

Tags
throws
Exception
Return values
void

Search results