VuFind API Documentation

FolioTest extends TestCase
in package
Uses FixtureTrait, ReflectionTrait

FOLIO ILS driver test

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

$currentFixture  : string
Current fixture name
$currentFixtureStep  : int
Current fixture step
$defaultDriverConfig  : array<string|int, mixed>
Default test configuration
$driver  : Folio
Driver under test
$fixtureSteps  : array<string|int, mixed>
Test data for simulated HTTP responses (reset by each test)
mockMakeRequest()  : Response
Replace makeRequest to inject test returns
testAvailableItemGetMyHolds()  : void
Test successful call to holds, one available item
testAvailableProxyItemGetMyHolds()  : void
Test successful call to holds, one available item placed for a proxy
testCancelHoldsMixedStatuses()  : void
Confirm that cancel holds processes various statuses appropriately.
testCancelHoldsPatronValidation()  : void
Confirm that cancel holds validates the current patron.
testCheckInvalidToken()  : void
Check and renew an invalid token retrieved from session cache (RTR authentication)
testCheckInvalidTokenLegacyAuth()  : void
Check and renew an invalid token retrieved from session cache (legacy authentication)
testCheckValidToken()  : void
Check a valid token retrieved from session cache
testGetBoundWithRecords()  : void
Test getBoundWithRecords with an item with six boundWithTitles.
testGetHoldingFilteringOfEmptyHoldingStatements()  : void
Test getHolding filters empty holding statements appropriately.
testGetHoldingMultiVolumeWithVuFindSorting()  : void
Test getHolding with VuFind-based sorting.
testGetHoldingWithDueDate()  : void
Test getHolding with checked out item.
testGetHoldingWithFolioSorting()  : void
Test getHolding with FOLIO-based sorting.
testGetHoldingWithHridLookup()  : void
Test getHolding with HRID-based lookup
testGetMyProfile()  : void
Test the getMyProfile method.
testGetPagedResultsEqualToLimit()  : void
Test getPagedResults with results equal to the limit value returned
testGetPagedResultsEstimatedTotal()  : void
Test getPagedResults with estimates being passed back from folio for the first response. This is different from testGetPagedResultsEqualToLimit since the totalRecords in the response from the API is inacurrate for the first response (i.e. just an estimate).
testGetPagedResultsGreaterThanLimit()  : void
Test getPagedResults with greater than the limit value returned
testGetPagedResultsLessThanLimit()  : void
Test getPagedResults with less than the limit value returned
testGetProxiedUsers()  : void
Test the getProxiedUsers method.
testGetProxyingUsers()  : void
Test the getProxyingUsers method.
testGetStatuses()  : void
Test getStatuses.
testInTransitItemGetMyHolds()  : void
Test successful call to holds, one in_transit item
testIsHoldableCaseSensitivityConfig()  : void
Test calls to isHoldable that verify that the excludeHoldLocationsCompareMode config is case insensitive
testIsHoldableDefaultConfig()  : void
Test calls to isHoldable when no excludeHoldLocationsCompareMode config value is set
testIsHoldableExactMode()  : void
Test calls to isHoldable with the exact compare mode
testIsHoldableExactModeInvalidInput()  : void
Test calls to isHoldable using exact mode with invalid location values and paramter values to isHoldable
testIsHoldableInvalidRegex()  : void
Test calls to isHoldable to verify handling of invalid regex when in regex compare mode
testIsHoldableRegexMode()  : void
Test calls to isHoldable when using regex mode
testNoItemsGetMyHolds()  : void
Test successful call to holds, no items
testSingleItemGetMyHolds()  : void
Test successful call to holds, item in queue, position x
testSuccessfulPatronLoginWithOkapi()  : void
Test patron login with Okapi (RTR authentication)
testSuccessfulPatronLoginWithOkapiLegacyAuth()  : void
Test patron login with Okapi (Legacy authentication)
testSuccessfulPlaceHold()  : void
Test successful place hold
testSuccessfulPlaceHoldLegacy()  : void
Test successful place hold (using an old version of mod-circulation)
testSuccessfulPlaceHoldNoExpirationDate()  : void
Test successful place hold with no expiration date
testSuccessfulPlaceTitleLevelHoldAfterRequestTypeFallback()  : void
Test successful place hold using request type fallback
testSuccessfulRenewMyItems()  : void
Test successful renewal
testTokens()  : void
Request a token where one does not exist (RTR authentication)
testTokensWithLegacyAuth()  : void
Request a token where one does not exist (legacy authentication)
testUnsuccessfulPatronLogin()  : void
Test an unsuccessful patron login with default settings
testUnsuccessfulPlaceHold()  : void
Test unsuccessful place hold
testUnsuccessfulPlaceHoldInvalidExpirationDate()  : void
Test unsuccessful place hold with invalid expiration date
callMethod()  : mixed
Call protected or private method for side-effect and result.
createConnector()  : void
Generate a new Folio driver to return responses set in a json fixture
getExpectedGetHoldingResult()  : array<string|int, mixed>
Get expected result of get-holding fixture (shared by multiple tests).
getFixture()  : string
Load a fixture file.
getFixtureDir()  : string
Get the base directory containing fixtures.
getFixturePath()  : string
Resolve fixture path.
getJsonFixture()  : array<string|int, mixed>
Load a JSON fixture from file (using associative array return type).
getProperty()  : mixed
Return protected or private property.
setProperty()  : void
Set protected or private property.

Properties

$currentFixture

Current fixture name

protected string $currentFixture = 'none'

$currentFixtureStep

Current fixture step

protected int $currentFixtureStep = 0

$defaultDriverConfig

Default test configuration

protected array<string|int, mixed> $defaultDriverConfig = ['API' => ['base_url' => 'localhost', 'tenant' => 'config_tenant', 'username' => 'config_username', 'password' => 'config_password', 'legacy_authentication' => false]]

$fixtureSteps

Test data for simulated HTTP responses (reset by each test)

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

Methods

mockMakeRequest()

Replace makeRequest to inject test returns

public mockMakeRequest([string $method = 'GET' ][, string $path = '/' ][, string|array<string|int, mixed> $params = [] ][, array<string|int, mixed> $headers = [] ]) : Response
Parameters
$method : string = 'GET'

GET/POST/PUT/DELETE/etc

$path : string = '/'

API path (with a leading /)

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

Parameters object to be sent as data

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

Additional headers

Return values
Response

testAvailableItemGetMyHolds()

Test successful call to holds, one available item

public testAvailableItemGetMyHolds() : void
Tags
depends

testTokens

Return values
void

testAvailableProxyItemGetMyHolds()

Test successful call to holds, one available item placed for a proxy

public testAvailableProxyItemGetMyHolds() : void
Tags
depends

testTokens

Return values
void

testCancelHoldsMixedStatuses()

Confirm that cancel holds processes various statuses appropriately.

public testCancelHoldsMixedStatuses() : void
Tags
depends

testTokens

Return values
void

testCancelHoldsPatronValidation()

Confirm that cancel holds validates the current patron.

public testCancelHoldsPatronValidation() : void
Tags
depends

testTokens

Return values
void

testCheckInvalidToken()

Check and renew an invalid token retrieved from session cache (RTR authentication)

public testCheckInvalidToken() : void
Tags
depends

testTokens

Return values
void

testCheckInvalidTokenLegacyAuth()

Check and renew an invalid token retrieved from session cache (legacy authentication)

public testCheckInvalidTokenLegacyAuth() : void
Tags
depends

testTokensWithLegacyAuth

Return values
void

testCheckValidToken()

Check a valid token retrieved from session cache

public testCheckValidToken() : void
Tags
depends

testTokens

Return values
void

testGetBoundWithRecords()

Test getBoundWithRecords with an item with six boundWithTitles.

public testGetBoundWithRecords() : void
Tags
depends

testTokens

Return values
void

testGetHoldingFilteringOfEmptyHoldingStatements()

Test getHolding filters empty holding statements appropriately.

public testGetHoldingFilteringOfEmptyHoldingStatements() : void
Tags
depends

testTokens

Return values
void

testGetHoldingMultiVolumeWithVuFindSorting()

Test getHolding with VuFind-based sorting.

public testGetHoldingMultiVolumeWithVuFindSorting() : void
Tags
depends

testTokens

Return values
void

testGetHoldingWithDueDate()

Test getHolding with checked out item.

public testGetHoldingWithDueDate() : void
Tags
depends

testTokens

Return values
void

testGetHoldingWithFolioSorting()

Test getHolding with FOLIO-based sorting.

public testGetHoldingWithFolioSorting() : void
Tags
depends

testTokens

Return values
void

testGetHoldingWithHridLookup()

Test getHolding with HRID-based lookup

public testGetHoldingWithHridLookup() : void
Tags
depends

testTokens

Return values
void

testGetMyProfile()

Test the getMyProfile method.

public testGetMyProfile() : void
Tags
depends

testTokens

Return values
void

testGetPagedResultsEqualToLimit()

Test getPagedResults with results equal to the limit value returned

public testGetPagedResultsEqualToLimit() : void
Tags
depends

testTokens

Return values
void

testGetPagedResultsEstimatedTotal()

Test getPagedResults with estimates being passed back from folio for the first response. This is different from testGetPagedResultsEqualToLimit since the totalRecords in the response from the API is inacurrate for the first response (i.e. just an estimate).

public testGetPagedResultsEstimatedTotal() : void
Tags
depends

testTokens

Return values
void

testGetPagedResultsGreaterThanLimit()

Test getPagedResults with greater than the limit value returned

public testGetPagedResultsGreaterThanLimit() : void
Tags
depends

testTokens

Return values
void

testGetPagedResultsLessThanLimit()

Test getPagedResults with less than the limit value returned

public testGetPagedResultsLessThanLimit() : void
Tags
depends

testTokens

Return values
void

testGetProxiedUsers()

Test the getProxiedUsers method.

public testGetProxiedUsers() : void
Tags
depends

testTokens

Return values
void

testGetProxyingUsers()

Test the getProxyingUsers method.

public testGetProxyingUsers() : void
Tags
depends

testTokens

Return values
void

testGetStatuses()

Test getStatuses.

public testGetStatuses() : void
Tags
depends

testTokens

Return values
void

testInTransitItemGetMyHolds()

Test successful call to holds, one in_transit item

public testInTransitItemGetMyHolds() : void
Tags
depends

testTokens

Return values
void

testIsHoldableCaseSensitivityConfig()

Test calls to isHoldable that verify that the excludeHoldLocationsCompareMode config is case insensitive

public testIsHoldableCaseSensitivityConfig() : void
Tags
depends

testTokens

Return values
void

testIsHoldableDefaultConfig()

Test calls to isHoldable when no excludeHoldLocationsCompareMode config value is set

public testIsHoldableDefaultConfig() : void
Tags
depends

testTokens

Return values
void

testIsHoldableExactMode()

Test calls to isHoldable with the exact compare mode

public testIsHoldableExactMode() : void
Tags
depends

testTokens

Return values
void

testIsHoldableExactModeInvalidInput()

Test calls to isHoldable using exact mode with invalid location values and paramter values to isHoldable

public testIsHoldableExactModeInvalidInput() : void
Tags
depends

testTokens

Return values
void

testIsHoldableInvalidRegex()

Test calls to isHoldable to verify handling of invalid regex when in regex compare mode

public testIsHoldableInvalidRegex() : void
Tags
depends

testTokens

Return values
void

testIsHoldableRegexMode()

Test calls to isHoldable when using regex mode

public testIsHoldableRegexMode() : void
Tags
depends

testTokens

Return values
void

testNoItemsGetMyHolds()

Test successful call to holds, no items

public testNoItemsGetMyHolds() : void
Tags
depends

testTokens

Return values
void

testSingleItemGetMyHolds()

Test successful call to holds, item in queue, position x

public testSingleItemGetMyHolds() : void
Tags
depends

testTokens

Return values
void

testSuccessfulPatronLoginWithOkapi()

Test patron login with Okapi (RTR authentication)

public testSuccessfulPatronLoginWithOkapi() : void
Tags
depends

testTokens

Return values
void

testSuccessfulPatronLoginWithOkapiLegacyAuth()

Test patron login with Okapi (Legacy authentication)

public testSuccessfulPatronLoginWithOkapiLegacyAuth() : void
Tags
depends

testTokensWithLegacyAuth

Return values
void

testSuccessfulPlaceHold()

Test successful place hold

public testSuccessfulPlaceHold() : void
Tags
depends

testTokens

Return values
void

testSuccessfulPlaceHoldLegacy()

Test successful place hold (using an old version of mod-circulation)

public testSuccessfulPlaceHoldLegacy() : void
Tags
depends

testTokens

Return values
void

testSuccessfulPlaceHoldNoExpirationDate()

Test successful place hold with no expiration date

public testSuccessfulPlaceHoldNoExpirationDate() : void
Tags
depends

testTokens

Return values
void

testSuccessfulPlaceTitleLevelHoldAfterRequestTypeFallback()

Test successful place hold using request type fallback

public testSuccessfulPlaceTitleLevelHoldAfterRequestTypeFallback() : void
Tags
depends

testTokens

Return values
void

testSuccessfulRenewMyItems()

Test successful renewal

public testSuccessfulRenewMyItems() : void
Tags
depends

testTokens

Return values
void

testTokens()

Request a token where one does not exist (RTR authentication)

public testTokens() : void
Return values
void

testTokensWithLegacyAuth()

Request a token where one does not exist (legacy authentication)

public testTokensWithLegacyAuth() : void
Return values
void

testUnsuccessfulPatronLogin()

Test an unsuccessful patron login with default settings

public testUnsuccessfulPatronLogin() : void
Tags
depends

testTokens

Return values
void

testUnsuccessfulPlaceHold()

Test unsuccessful place hold

public testUnsuccessfulPlaceHold() : void
Tags
depends

testTokens

Return values
void

testUnsuccessfulPlaceHoldInvalidExpirationDate()

Test unsuccessful place hold with invalid expiration date

public testUnsuccessfulPlaceHoldInvalidExpirationDate() : void
Tags
depends

testTokens

Return values
void

callMethod()

Call protected or private method for side-effect and result.

protected callMethod(object|string $object, string $method[, array<string|int, mixed> $arguments = [] ]) : mixed

Uses PHP's reflection API in order to modify method accessibility.

Parameters
$object : object|string

Object or class name

$method : string

Method name

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

Method arguments

Tags
throws
ReflectionException

Method does not exist

Return values
mixed

createConnector()

Generate a new Folio driver to return responses set in a json fixture

protected createConnector(string $test[, array<string|int, mixed> $config = null ]) : void

Overwrites $this->driver Uses session cache

Parameters
$test : string

Name of test fixture to load

$config : array<string|int, mixed> = null

Driver configuration (null to use default)

Return values
void

getExpectedGetHoldingResult()

Get expected result of get-holding fixture (shared by multiple tests).

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

getFixture()

Load a fixture file.

protected getFixture(string $filename[, string $module = 'VuFind' ]) : string
Parameters
$filename : string

Filename relative to fixture directory.

$module : string = 'VuFind'

Module containing fixture.

Tags
throws
RuntimeException
Return values
string

getFixtureDir()

Get the base directory containing fixtures.

protected getFixtureDir([string $module = 'VuFind' ]) : string
Parameters
$module : string = 'VuFind'

Module containing fixture.

Return values
string

getFixturePath()

Resolve fixture path.

protected getFixturePath(string $filename[, string $module = 'VuFind' ]) : string
Parameters
$filename : string

Filename relative to fixture directory.

$module : string = 'VuFind'

Module containing fixture.

Tags
throws
RuntimeException
Return values
string

getJsonFixture()

Load a JSON fixture from file (using associative array return type).

protected getJsonFixture(string $filename[, string $module = 'VuFind' ]) : array<string|int, mixed>
Parameters
$filename : string

Filename relative to fixture directory.

$module : string = 'VuFind'

Module containing fixture.

Return values
array<string|int, mixed>

getProperty()

Return protected or private property.

protected getProperty(object|string $object, string $property) : mixed

Uses PHP's reflection API in order to modify property accessibility.

Parameters
$object : object|string

Object or class name

$property : string

Property name

Tags
throws
ReflectionException

Property does not exist

Return values
mixed

setProperty()

Set protected or private property.

protected setProperty(object|string $object, string $property, mixed $value) : void

Uses PHP's reflection API in order to modify property accessibility.

Parameters
$object : object|string

Object or class name

$property : string

Property name

$value : mixed

Property value

Tags
throws
ReflectionException

Property does not exist

Return values
void

Search results