VuFind API Documentation

IlsActionsTest extends MinkTestCase
in package
Uses DemoDriverTestTrait, LiveDatabaseTrait, UserCreationTrait

Mink ILS actions 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

DEFAULT_TIMEOUT  = 5000
$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).
$activeRecordTabSelector  : string
Selector for active record tab
$btnGroupDropdownMenuSelector  : string
Selector for an open button group dropdown menu
$firstOpenDropdownMenuItemSelector  : string
Selector for first item in a dropdown menu
$liveDatabaseContainer  : MockContainer|null
Container connected to live database.
$modifiedConfigs  : array<string|int, mixed>
Modified configurations
$modifiedYamlConfigs  : array<string|int, mixed>
Modified yaml configurations
$openModalButtonLinkSelector  : string
Selector for a button link in an open modal dialog
$openModalSelector  : string
Selector for an open modal dialog
$openModalUsernameFieldSelector  : string
Selector for a username field in open modal dialog
$pageNextSelector  : string
Selector for next page link
$pagePrevSelector  : string
Selector for previous page link
$pathResolver  : PathResolver
Configuration file path resolver
$popoverContentSelector  : string
Selector for popover content
$session  : Session
Mink session
continuousIntegrationRunning()  : bool
Is this test running in a continuous integration context?
getConfigIniOverrides()  : array<string|int, mixed>
Get config.ini override settings for testing ILS functions.
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.
getRemoteCoverageDirectory()  : string|null
Get the remote coverage directory (or return null if remote coverage disabled)
getTable()  : Gateway
Get a table object.
loanHistoryWithPurgeDisabledProvider()  : array<string|int, mixed>
Data provider for testLoanHistoryWithPurgeDisabled
setUp()  : void
Standard setup method.
setUpBeforeClass()  : void
Standard setup method.
tearDown()  : void
Standard teardown method.
tearDownAfterClass()  : void
Standard teardown method.
testCancelAllIllRequest()  : void
Test canceling an ILL request with "cancel all."
testCancelAllStorageRetrievalRequest()  : void
Test canceling storage retrieval requests with "cancel all."
testCancelSelectedIllRequest()  : void
Test canceling an ILL request with "cancel selected."
testCancelSelectedStorageRetrievalRequest()  : void
Test canceling storage retrieval requests with "cancel selected."
testDisabledUserLogin()  : void
Test that user profile action blocks login with catalog login is disabled.
testIllRequest()  : void
Test ILL requests.
testLoanHistory()  : void
Test loan history.
testLoanHistoryWithPurgeDisabled()  : void
Test transaction history with purge option(s) disabled.
testProfile()  : void
Test user profile action.
testRenewal()  : void
Test renewal action.
testStorageRetrievalRequest()  : void
Test storage retrieval requests.
addPathResolverToContainer()  : void
Add PathResolverFactory to a mock container
assertEqualsWithTimeout()  : void
Wait for a callback to return the expected value
assertLightboxTitle()  : void
Verify that lightbox title contains the expected value
assertLightboxWarning()  : void
Mink support function: assert a warning message in the lightbox.
assertStringContainsStringWithTimeout()  : void
Wait for a callback to return a string containing the expected value
assertWithTimeout()  : void
Wait for a callback to return the expected value
cancelAllProcedure()  : void
Test canceling a request with the "cancel all" button.
cancelSelectedProcedure()  : void
Test canceling a request with the "cancel selected" button.
changeConfigFile()  : void
Support method for changeConfig; act on a single file.
changeConfigs()  : void
Reconfigure VuFind for the current test.
changeYamlConfigFile()  : void
Support method for changeYamlConfig; act on a single file.
changeYamlConfigs()  : void
Reconfigure VuFind for the current test.
checkVisibility()  : bool
Test an element for visibility.
clickButtonGroupLink()  : void
Click a link inside a drop down button group.
clickCss()  : mixed
Click on a CSS element.
closeLightbox()  : void
Verify that lightbox title contains the expected value
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!
fillInAccountForm()  : void
Mink support function: fill in the account creation form.
fillInChangePasswordForm()  : void
Mink support function: fill in the change password form.
fillInLoginForm()  : void
Mink support function: fill in the login form.
findAndAssertLink()  : mixed
Retrieve a link and assert that it exists before returning it.
findCss()  : mixed
Wait for an element to exist, then retrieve it.
findCssAndCallMethod()  : string
Return value of a method of an element selected via CSS; retry if it fails due to DOM change.
findCssAndGetHtml()  : string
Get text of an element selected via CSS; retry if it fails due to DOM change.
findCssAndGetText()  : string
Get text of an element selected via CSS; retry if it fails due to DOM change.
findCssAndGetValue()  : string
Get value of an element selected via CSS; retry if it fails due to DOM change.
findCssAndSetValue()  : mixed
Set a value within an element selected via CSS; retry if set fails due to browser bugs.
getCurrentQueryString()  : string
Get query string for the current page
getCurrentUrlWithoutSid()  : string
Get current URL without any sid parameter in the query string
getDefaultTimeout()  : int
Get the default timeout in milliseconds
getDemoIniOverrides()  : array<string|int, mixed>
Get Demo.ini override settings for testing ILS functions.
getFakeHistoricTransactions()  : array<string|int, mixed>
Get historic transaction JSON for Demo.ini.
getFakeItem()  : array<string|int, mixed>
Get a fake item record for inclusion in the Demo driver configuration.
getFakeTransactions()  : array<string|int, mixed>
Get transaction JSON for Demo.ini.
getFirstMethodAttributeValue()  : mixed
Extract the first parameter of the first attribute matching the specified criteria.
getMinkDriver()  : Selenium2Driver
Get the Mink driver, initializing it if necessary.
getMinkSession()  : Session
Get a Mink session.
getPathResolver()  : PathResolver
Get a config file path resolver
getSearchHomePage()  : Element
Load the Search/Home page as a foundation for searching.
getSnoozeMultiplier()  : float
Get the snooze multiplier.
getTestName()  : string
Get name of the current test
getVuFindUrl()  : string
Get base URL of running VuFind instance.
goToLoanHistory()  : DocumentElement
Log in and open loan history page
gotoRecordById()  : Element
Move the current page to a record by performing a search.
hasElementsMatchingText()  : bool
Check whether an element containing the specified text exists.
htmlValidationMsgToStr()  : string
Convert a NU HTML Validator message to a string
illRequestProcedure()  : void
Routine to place an ILL request
logWarning()  : void
Log a warning message
outputHtmlValidationMessages()  : void
Output HTML validation messages to log file and/or console
performSearch()  : Element
Search for the specified query.
placeIllRequestAndGoToIllScreen()  : void
Support method to place an ILL request and end up on the ILL screen.
placeStorageRetrievalRequestAndGoToSRRScreen()  : void
Support method to place a storage retrieval request and end up on the SRR screen.
removeUsers()  : void
Static teardown support function to destroy user accounts. Accounts are expected to exist, and the method will fail if they are missing.
restoreConfigs()  : void
Restore configurations to the state they were in prior to a call to changeConfig().
setUpCancelIllTest()  : Element
Set up a cancel ILL request test.
setUpCancelStorageRetrievalTest()  : Element
Set up a cancel storage retrieval request test.
snooze()  : void
Sleep if necessary.
stopMinkSession()  : void
Shut down the Mink session.
storageRetrievalRequestProcedure()  : void
Routine to place a storage retrieval request
submitCatalogLoginForm()  : void
Fill in and submit the catalog login form with the provided credentials.
submitLoginForm()  : void
Submit the login form (assuming it's open).
submitSearchForm()  : void
Submit a search on the provided page.
unFindCss()  : void
Wait for an element to NOT exist.
validateHtml()  : void
Validate current page HTML if validation is enabled and a session exists
waitForLightboxHidden()  : void
Wait for Lightbox to become hidden if it isn't already.
waitForPageLoad()  : void
Wait for page load (full page or any element) to complete
waitStatement()  : mixed
Wait for a JavaScript statement to result in true.

Constants

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

$activeRecordTabSelector

Selector for active record tab

protected string $activeRecordTabSelector = 'li.record-tab.active, li.record-tab a.active'

First for Bootstrap 3, second for Bootstrap 5

$btnGroupDropdownMenuSelector

Selector for an open button group dropdown menu

protected string $btnGroupDropdownMenuSelector = '.btn-group.open .dropdown-menu, .btn-group .dropdown-menu.show'

First for Bootstrap 3, second for Bootstrap 5

$firstOpenDropdownMenuItemSelector

Selector for first item in a dropdown menu

protected string $firstOpenDropdownMenuItemSelector = '.mainbody .open .dropdown-menu li:nth-child(1) a, .mainbody .dropdown-menu.show li:nth-child(1) a'

First for Bootstrap 3, second for Bootstrap 5

$modifiedConfigs

Modified configurations

protected array<string|int, mixed> $modifiedConfigs = []

$modifiedYamlConfigs

Modified yaml configurations

protected array<string|int, mixed> $modifiedYamlConfigs = []

$openModalButtonLinkSelector

Selector for a button link in an open modal dialog

protected string $openModalButtonLinkSelector = '#modal.in a.btn, #modal.show a.btn'

First for Bootstrap 3, second for Bootstrap 5

$openModalSelector

Selector for an open modal dialog

protected string $openModalSelector = '#modal.in, #modal.show'

First for Bootstrap 3, second for Bootstrap 5

$openModalUsernameFieldSelector

Selector for a username field in open modal dialog

protected string $openModalUsernameFieldSelector = '#modal.in [name="username"], #modal.show [name="username"]'

First for Bootstrap 3, second for Bootstrap 5

$pageNextSelector

Selector for next page link

protected string $pageNextSelector = 'a.page-next, .page-next a'

First for Bootstrap 3, second for Bootstrap 5

$pagePrevSelector

Selector for previous page link

protected string $pagePrevSelector = 'a.page-prev, .page-prev a'

First for Bootstrap 3, second for Bootstrap 5

$popoverContentSelector

Selector for popover content

protected string $popoverContentSelector = '.popover-body, .popover-content'

First for Bootstrap 3, second for Bootstrap 5

Methods

continuousIntegrationRunning()

Is this test running in a continuous integration context?

public continuousIntegrationRunning() : bool
Return values
bool

getConfigIniOverrides()

Get config.ini override settings for testing ILS functions.

public getConfigIniOverrides() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRemoteCoverageDirectory()

Get the remote coverage directory (or return null if remote coverage disabled)

public getRemoteCoverageDirectory() : string|null
Return values
string|null

getTable()

Get a table object.

public getTable(string $table) : Gateway
Parameters
$table : string

Name of table to load

Return values
Gateway

loanHistoryWithPurgeDisabledProvider()

Data provider for testLoanHistoryWithPurgeDisabled

public static loanHistoryWithPurgeDisabledProvider() : array<string|int, mixed>
Return values
array<string|int, mixed>

setUp()

Standard setup method.

public setUp() : void
Return values
void

setUpBeforeClass()

Standard setup method.

public static setUpBeforeClass() : void
Return values
void

tearDown()

Standard teardown method.

public tearDown() : void
Return values
void

tearDownAfterClass()

Standard teardown method.

public static tearDownAfterClass() : void
Return values
void

testCancelAllIllRequest()

Test canceling an ILL request with "cancel all."

public testCancelAllIllRequest() : void
Tags
depends

testProfile

Return values
void

testCancelAllStorageRetrievalRequest()

Test canceling storage retrieval requests with "cancel all."

public testCancelAllStorageRetrievalRequest() : void
Tags
depends

testProfile

Return values
void

testCancelSelectedIllRequest()

Test canceling an ILL request with "cancel selected."

public testCancelSelectedIllRequest() : void
Tags
depends

testProfile

Return values
void

testCancelSelectedStorageRetrievalRequest()

Test canceling storage retrieval requests with "cancel selected."

public testCancelSelectedStorageRetrievalRequest() : void
Tags
depends

testProfile

Return values
void

testDisabledUserLogin()

Test that user profile action blocks login with catalog login is disabled.

public testDisabledUserLogin() : void

Note that we need to run this test FIRST, because after this, VuFind will remember the credentials and won't display the login form again.

Return values
void

testIllRequest()

Test ILL requests.

public testIllRequest() : void
Tags
depends

testProfile

Return values
void

testLoanHistory()

Test loan history.

public testLoanHistory() : void
Tags
depends

testProfile

Return values
void

testLoanHistoryWithPurgeDisabled()

Test transaction history with purge option(s) disabled.

public testLoanHistoryWithPurgeDisabled(bool $selected, bool $all) : void
Parameters
$selected : bool

Whether to enable Purge Selected

$all : bool

Whether to enable Purge All

Tags
dataProvider

loanHistoryWithPurgeDisabledProvider

depends

testProfile

Return values
void

testProfile()

Test user profile action.

public testProfile() : void
Return values
void

testRenewal()

Test renewal action.

public testRenewal() : void
Tags
depends

testProfile

Return values
void

testStorageRetrievalRequest()

Test storage retrieval requests.

public testStorageRetrievalRequest() : void
Tags
depends

testProfile

Return values
void

addPathResolverToContainer()

Add PathResolverFactory to a mock container

protected addPathResolverToContainer(MockContainer $container) : void
Parameters
$container : MockContainer

Mock Container

Return values
void

assertEqualsWithTimeout()

Wait for a callback to return the expected value

protected assertEqualsWithTimeout(mixed $expected, callable $callback[, int $timeout = null ]) : void
Parameters
$expected : mixed

Expected value

$callback : callable

Callback

$timeout : int = null

Wait timeout (in ms)

Return values
void

assertLightboxTitle()

Verify that lightbox title contains the expected value

protected assertLightboxTitle(Element $page, string $title) : void
Parameters
$page : Element

Page element

$title : string

Expected title

Return values
void

assertLightboxWarning()

Mink support function: assert a warning message in the lightbox.

protected assertLightboxWarning(Element $page, string $message) : void
Parameters
$page : Element

Page element

$message : string

Expected message

Return values
void

assertStringContainsStringWithTimeout()

Wait for a callback to return a string containing the expected value

protected assertStringContainsStringWithTimeout(string $expected, callable $callback[, int $timeout = null ]) : void
Parameters
$expected : string

Expected value

$callback : callable

Callback

$timeout : int = null

Wait timeout (in ms)

Return values
void

assertWithTimeout()

Wait for a callback to return the expected value

protected assertWithTimeout(mixed $expected, callable $callback, callable $compareFunc, callable $assertion[, int $timeout = null ]) : void
Parameters
$expected : mixed

Expected value

$callback : callable

Callback used to get the results

$compareFunc : callable

Callback used to compare the results

$assertion : callable

Assertion to make

$timeout : int = null

Wait timeout (in ms)

Return values
void

cancelAllProcedure()

Test canceling a request with the "cancel all" button.

protected cancelAllProcedure(Element $page, string $type) : void
Parameters
$page : Element

Page element.

$type : string

Request type being tested.

Return values
void

cancelSelectedProcedure()

Test canceling a request with the "cancel selected" button.

protected cancelSelectedProcedure(Element $page, string $type) : void
Parameters
$page : Element

Page element.

$type : string

Request type being tested.

Return values
void

changeConfigFile()

Support method for changeConfig; act on a single file.

protected changeConfigFile(string $configName, array<string|int, mixed> $settings[, bool $replace = false ]) : void
Parameters
$configName : string

Configuration to modify.

$settings : array<string|int, mixed>

Settings to change.

$replace : bool = false

Should we replace the existing config entirely (as opposed to extending it with new settings)?

Return values
void

changeConfigs()

Reconfigure VuFind for the current test.

protected changeConfigs(array<string|int, mixed> $configs[, array<string|int, mixed> $replace = [] ]) : void
Parameters
$configs : array<string|int, mixed>

Array of settings to change. Top-level keys correspond with config filenames (i.e. use 'config' for config.ini, etc.); within each file's array, top-level key is config section. Within each section's array are key-value configuration pairs.

$replace : array<string|int, mixed> = []

Array of config files to completely override (as opposed to modifying); if a config file from $configs is included in this array, the $configs setting will be used as the entire configuration, and the defaults from the config/vufind directory will be ignored.

Return values
void

changeYamlConfigFile()

Support method for changeYamlConfig; act on a single file.

protected changeYamlConfigFile(string $configName, array<string|int, mixed> $settings[, bool $replace = false ]) : void
Parameters
$configName : string

Configuration to modify.

$settings : array<string|int, mixed>

Settings to change.

$replace : bool = false

Should we replace the existing config entirely (as opposed to extending it with new settings)?

Return values
void

changeYamlConfigs()

Reconfigure VuFind for the current test.

protected changeYamlConfigs(array<string|int, mixed> $configs[, array<string|int, mixed> $replace = [] ]) : void
Parameters
$configs : array<string|int, mixed>

Array of settings to change. Top-level keys correspond with yaml config filenames (i.e. use 'searchspecs' for searchspecs.yaml, etc.);

$replace : array<string|int, mixed> = []

Array of config files to completely override (as opposed to modifying); if a config file from $configs is included in this array, the $configs setting will be used as the entire configuration, and the defaults from the config/vufind directory will be ignored.

Return values
void

checkVisibility()

Test an element for visibility.

protected checkVisibility(Element $element) : bool
Parameters
$element : Element

Element to test

Return values
bool

Click a link inside a drop down button group.

protected clickButtonGroupLink(Element $page, string $text) : void
Parameters
$page : Element

Page element.

$text : string

Text to match on link.

Return values
void

clickCss()

Click on a CSS element.

protected clickCss(Element $page, string $selector[, int $timeout = null ], int $index) : mixed
Parameters
$page : Element

Page element

$selector : string

CSS selector

$timeout : int = null

Wait timeout (in ms)

$index : int

Index of the element (0-based)

Return values
mixed

closeLightbox()

Verify that lightbox title contains the expected value

protected closeLightbox(Element $page[, bool $closeButton = false ]) : void
Parameters
$page : Element

Page element

$closeButton : bool = false

Whether there should be a close button in the modal body

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

fillInAccountForm()

Mink support function: fill in the account creation form.

protected fillInAccountForm(Element $page[, array<string|int, mixed> $overrides = [] ]) : void
Parameters
$page : Element

Page element.

$overrides : array<string|int, mixed> = []

Optional overrides for form values.

Return values
void

fillInChangePasswordForm()

Mink support function: fill in the change password form.

protected fillInChangePasswordForm(Element $page, string $old, string $new[, bool $inModal = false ][, string $prefix = '#newpassword ' ]) : void
Parameters
$page : Element

Page element.

$old : string

Old password

$new : string

New password

$inModal : bool = false

Should we assume the login box is in a lightbox?

$prefix : string = '#newpassword '

Extra selector prefix

Return values
void

fillInLoginForm()

Mink support function: fill in the login form.

protected fillInLoginForm(Element $page, string $username, string $password[, bool $inModal = true ][, string $prefix = '' ]) : void
Parameters
$page : Element

Page element.

$username : string

Username to set (null to skip)

$password : string

Password to set (null to skip)

$inModal : bool = true

Should we assume the login box is in a lightbox?

$prefix : string = ''

Extra selector prefix

Return values
void

Retrieve a link and assert that it exists before returning it.

protected findAndAssertLink(Element $page, string $text) : mixed
Parameters
$page : Element

Page element

$text : string

Link text to match

Return values
mixed

findCss()

Wait for an element to exist, then retrieve it.

protected findCss(Element $page, string $selector[, int $timeout = null ], int $index) : mixed
Parameters
$page : Element

Page element

$selector : string

CSS selector

$timeout : int = null

Wait timeout (in ms)

$index : int

Index of the element (0-based)

Return values
mixed

findCssAndCallMethod()

Return value of a method of an element selected via CSS; retry if it fails due to DOM change.

protected findCssAndCallMethod(Element $page, string $selector, callable $method[, int $timeout = null ], int $index[, int $retries = 6 ]) : string
Parameters
$page : Element

Page element

$selector : string

CSS selector

$method : callable

Method to call

$timeout : int = null

Wait timeout for CSS selection (in ms)

$index : int

Index of the element (0-based)

$retries : int = 6

Retry count for set loop

Return values
string

findCssAndGetHtml()

Get text of an element selected via CSS; retry if it fails due to DOM change.

protected findCssAndGetHtml(Element $page, string $selector[, int $timeout = null ], int $index[, int $retries = 6 ]) : string
Parameters
$page : Element

Page element

$selector : string

CSS selector

$timeout : int = null

Wait timeout for CSS selection (in ms)

$index : int

Index of the element (0-based)

$retries : int = 6

Retry count for set loop

Return values
string

findCssAndGetText()

Get text of an element selected via CSS; retry if it fails due to DOM change.

protected findCssAndGetText(Element $page, string $selector[, int $timeout = null ], int $index[, int $retries = 6 ]) : string
Parameters
$page : Element

Page element

$selector : string

CSS selector

$timeout : int = null

Wait timeout for CSS selection (in ms)

$index : int

Index of the element (0-based)

$retries : int = 6

Retry count for set loop

Return values
string

findCssAndGetValue()

Get value of an element selected via CSS; retry if it fails due to DOM change.

protected findCssAndGetValue(Element $page, string $selector[, int $timeout = null ], int $index[, int $retries = 6 ]) : string
Parameters
$page : Element

Page element

$selector : string

CSS selector

$timeout : int = null

Wait timeout for CSS selection (in ms)

$index : int

Index of the element (0-based)

$retries : int = 6

Retry count for set loop

Return values
string

findCssAndSetValue()

Set a value within an element selected via CSS; retry if set fails due to browser bugs.

protected findCssAndSetValue(Element $page, string $selector, string $value[, int $timeout = null ][, int $retries = 6 ][, bool $verifyValue = true ]) : mixed
Parameters
$page : Element

Page element

$selector : string

CSS selector

$value : string

Value to set

$timeout : int = null

Wait timeout for CSS selection (in ms)

$retries : int = 6

Retry count for set loop

$verifyValue : bool = true

Whether to verify that the value was written

Return values
mixed

getCurrentQueryString()

Get query string for the current page

protected getCurrentQueryString([bool $excludeSid = false ]) : string
Parameters
$excludeSid : bool = false

Whether to remove any sid from the query string

Return values
string

getCurrentUrlWithoutSid()

Get current URL without any sid parameter in the query string

protected getCurrentUrlWithoutSid() : string
Return values
string

getDefaultTimeout()

Get the default timeout in milliseconds

protected getDefaultTimeout() : int
Return values
int

getDemoIniOverrides()

Get Demo.ini override settings for testing ILS functions.

protected getDemoIniOverrides([string $bibId = 'testsample1' ][, string $bibId2 = 'testsample2' ]) : array<string|int, mixed>
Parameters
$bibId : string = 'testsample1'

Bibliographic record ID to create fake item info for.

$bibId2 : string = 'testsample2'

Bibliographic record ID for a second transaction history row.

Return values
array<string|int, mixed>

getFakeHistoricTransactions()

Get historic transaction JSON for Demo.ini.

protected getFakeHistoricTransactions(string $bibId, string $bibId2) : array<string|int, mixed>
Parameters
$bibId : string

Bibliographic record ID to create fake item info for.

$bibId2 : string

Another bibliographic record ID to create fake item info for.

Return values
array<string|int, mixed>

getFakeItem()

Get a fake item record for inclusion in the Demo driver configuration.

protected getFakeItem() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFakeTransactions()

Get transaction JSON for Demo.ini.

protected getFakeTransactions(string $bibId) : array<string|int, mixed>
Parameters
$bibId : string

Bibliographic record ID to create fake item info for.

Return values
array<string|int, mixed>

getFirstMethodAttributeValue()

Extract the first parameter of the first attribute matching the specified criteria.

protected getFirstMethodAttributeValue(string $method, string $attribute[, mixed $default = null ]) : mixed
Parameters
$method : string

Method name to check for attributes

$attribute : string

Attribute class name to look up

$default : mixed = null

Default value to use if no match found

Tags
throws
ReflectionException
Return values
mixed

getMinkDriver()

Get the Mink driver, initializing it if necessary.

protected getMinkDriver() : Selenium2Driver
Return values
Selenium2Driver

getPathResolver()

Get a config file path resolver

protected getPathResolver([string|null $baseDirectory = null ]) : PathResolver
Parameters
$baseDirectory : string|null = null

Optional directory to override APPLICATION_PATH

Return values
PathResolver

getSearchHomePage()

Load the Search/Home page as a foundation for searching.

protected getSearchHomePage([Session|null $session = null ]) : Element
Parameters
$session : Session|null = null

Mink session (will be automatically established if not provided).

Return values
Element

getSnoozeMultiplier()

Get the snooze multiplier.

protected getSnoozeMultiplier() : float
Return values
float

getTestName()

Get name of the current test

protected getTestName() : string
Return values
string

getVuFindUrl()

Get base URL of running VuFind instance.

protected getVuFindUrl([string $path = '' ]) : string
Parameters
$path : string = ''

Relative path to add to base URL.

Return values
string

goToLoanHistory()

Log in and open loan history page

protected goToLoanHistory() : DocumentElement
Return values
DocumentElement

gotoRecordById()

Move the current page to a record by performing a search.

protected gotoRecordById([string $id = 'testsample1' ]) : Element
Parameters
$id : string = 'testsample1'

ID of record to access.

Return values
Element

hasElementsMatchingText()

Check whether an element containing the specified text exists.

protected hasElementsMatchingText(Element $page, string $selector, string $text) : bool
Parameters
$page : Element

Page element

$selector : string

CSS selector

$text : string

Expected text

Return values
bool

htmlValidationMsgToStr()

Convert a NU HTML Validator message to a string

protected htmlValidationMsgToStr(array<string|int, mixed> $message) : string
Parameters
$message : array<string|int, mixed>

Validation message

Return values
string

illRequestProcedure()

Routine to place an ILL request

protected illRequestProcedure(Element $page) : void
Parameters
$page : Element

Page element.

Return values
void

logWarning()

Log a warning message

protected logWarning(string $consoleMsg[, string $logMsg = '' ]) : void
Parameters
$consoleMsg : string

Message to output to console

$logMsg : string = ''

Message to output to PHP error log

Return values
void

outputHtmlValidationMessages()

Output HTML validation messages to log file and/or console

protected outputHtmlValidationMessages(array<string|int, mixed> $messages, string $level, string $logFile, bool $quiet) : void
Parameters
$messages : array<string|int, mixed>

Messages

$level : string

Message level (info or error)

$logFile : string

Log file name

$quiet : bool

Whether the console output should be quiet

Return values
void

performSearch()

Search for the specified query.

protected performSearch(string $query[, string $handler = null ][, string $path = '/Search' ]) : Element
Parameters
$query : string

Search term(s)

$handler : string = null

Search type (optional)

$path : string = '/Search'

Path to use as search starting point (optional)

Return values
Element

placeIllRequestAndGoToIllScreen()

Support method to place an ILL request and end up on the ILL screen.

protected placeIllRequestAndGoToIllScreen(Element $page) : void
Parameters
$page : Element

Page element.

Return values
void

placeStorageRetrievalRequestAndGoToSRRScreen()

Support method to place a storage retrieval request and end up on the SRR screen.

protected placeStorageRetrievalRequestAndGoToSRRScreen(Element $page) : void
Parameters
$page : Element

Page element.

Return values
void

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

restoreConfigs()

Restore configurations to the state they were in prior to a call to changeConfig().

protected restoreConfigs() : void
Return values
void

setUpCancelIllTest()

Set up a cancel ILL request test.

protected setUpCancelIllTest() : Element
Return values
Element

setUpCancelStorageRetrievalTest()

Set up a cancel storage retrieval request test.

protected setUpCancelStorageRetrievalTest() : Element
Return values
Element

snooze()

Sleep if necessary.

protected snooze([int $secs = 1 ]) : void
Parameters
$secs : int = 1

Seconds to sleep

Return values
void

stopMinkSession()

Shut down the Mink session.

protected stopMinkSession() : void
Return values
void

storageRetrievalRequestProcedure()

Routine to place a storage retrieval request

protected storageRetrievalRequestProcedure(Element $page) : void
Parameters
$page : Element

Page element.

Return values
void

submitCatalogLoginForm()

Fill in and submit the catalog login form with the provided credentials.

protected submitCatalogLoginForm(Element $page, string $username, string $password) : void
Parameters
$page : Element

Page element.

$username : string

Username

$password : string

Password

Return values
void

submitLoginForm()

Submit the login form (assuming it's open).

protected submitLoginForm(Element $page[, bool $inModal = true ][, string $prefix = '' ]) : void
Parameters
$page : Element

Page element.

$inModal : bool = true

Should we assume the login box is in a lightbox?

$prefix : string = ''

Extra selector prefix

Return values
void

submitSearchForm()

Submit a search on the provided page.

protected submitSearchForm(Element $page, string $query[, string $handler = null ]) : void
Parameters
$page : Element

Current page object

$query : string

Search term(s)

$handler : string = null

Search type (optional)

Tags
throws
Exception
Return values
void

unFindCss()

Wait for an element to NOT exist.

protected unFindCss(Element $page, string $selector[, int $timeout = null ], int $index) : void
Parameters
$page : Element

Page element

$selector : string

CSS selector

$timeout : int = null

Wait timeout (in ms)

$index : int

Index of the element (0-based)

Return values
void

validateHtml()

Validate current page HTML if validation is enabled and a session exists

protected validateHtml([Element|null $page = null ]) : void
Parameters
$page : Element|null = null

Page to check (optional; uses the page from session by default)

Tags
throws
RuntimeException
Return values
void

waitForLightboxHidden()

Wait for Lightbox to become hidden if it isn't already.

protected waitForLightboxHidden() : void
Return values
void

waitForPageLoad()

Wait for page load (full page or any element) to complete

protected waitForPageLoad(Element $page[, int $timeout = null ]) : void
Parameters
$page : Element

Page element

$timeout : int = null

Wait timeout (in ms)

Return values
void

waitStatement()

Wait for a JavaScript statement to result in true.

protected waitStatement(string $statement[, int $timeout = null ]) : mixed

Includes a check for $ to be available to make sure jQuery has been loaded.

Parameters
$statement : string

JavaScript statement to evaluate

$timeout : int = null

Wait timeout (in ms)

Return values
mixed

Search results