GeniePlusTest
extends ILSDriverTestCase
in package
Uses
FixtureTrait, WithConsecutiveTrait
GeniePlus ILS driver test
Tags
Table of Contents
- $config : array<string|int, mixed>
- Default driver configuration
- $defaultPatron : array<string|int, mixed>
- Default expected patron login response
- $driver : AbstractBase
- ILS driver
- $expectedLoginRequest : array<string|int, mixed>
- Expected parameters to patron login request
- $expectedTokenRequest : array<string|int, mixed>
- Expected parameters to token generation request
- setUp() : void
- Standard setup method.
- testAPIFailure() : void
- Test API failure
- testGetHoldingWithDefaultSort() : void
- Test holdings lookup with default sort
- testGetHoldingWithNonDefaultAscendingSort() : void
- Test holdings lookup with custom ascending sort
- testGetHoldingWithNonDefaultDescendingSort() : void
- Test holdings lookup with custom descending sort
- testGetMyProfile() : void
- Test profile retrieval
- testGetMyTransactions() : void
- Test transaction retrieval
- testMissingConfiguration() : void
- Test that driver complains about missing configuration.
- testPatronLogin() : void
- Test patron login
- testTokenAutoRenewal() : void
- Test token auto-renewal
- expectConsecutiveCalls() : InvocationStubber
- Expect consecutive calls to a mock.
- 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).
- getMockResponse() : Response
- Get a mock response with a predetermined body.
- setUpHoldingTest() : void
- Configure the driver to respond to a getHolding() call.
Properties
$config
Default driver configuration
protected
array<string|int, mixed>
$config
$defaultPatron
Default expected patron login response
protected
array<string|int, mixed>
$defaultPatron
= ['id' => 'fake.user.fake.com', 'firstname' => 'Fake', 'lastname' => 'User', 'cat_username' => 'foo@foo.com', 'cat_password' => 'bar', 'email' => 'fake.user@fake.com', 'major' => null, 'college' => null]
$driver
ILS driver
protected
AbstractBase
$driver
$expectedLoginRequest
Expected parameters to patron login request
protected
array<string|int, mixed>
$expectedLoginRequest
= ['GET', '/_rest/databases/api_database_name/templates/Borrower/search-result', ['page-size' => 1, 'page' => 0, 'fields' => 'ID,Name,Email', 'command' => "Email == 'foo@foo.com' AND InstitutionalIdNumber == 'bar'"], ['Accept: application/json', 'Authorization: Bearer fake-token']]
$expectedTokenRequest
Expected parameters to token generation request
protected
array<string|int, mixed>
$expectedTokenRequest
= ['POST', '/_oauth/token', ['client_id' => 'api_oauth_id', 'grant_type' => 'password', 'database' => 'api_database_name', 'username' => 'api_username', 'password' => 'api_password'], ['Accept: application/json']]
Methods
setUp()
Standard setup method.
public
setUp() : void
Return values
void —testAPIFailure()
Test API failure
public
testAPIFailure() : void
Return values
void —testGetHoldingWithDefaultSort()
Test holdings lookup with default sort
public
testGetHoldingWithDefaultSort() : void
Return values
void —testGetHoldingWithNonDefaultAscendingSort()
Test holdings lookup with custom ascending sort
public
testGetHoldingWithNonDefaultAscendingSort() : void
Return values
void —testGetHoldingWithNonDefaultDescendingSort()
Test holdings lookup with custom descending sort
public
testGetHoldingWithNonDefaultDescendingSort() : void
Return values
void —testGetMyProfile()
Test profile retrieval
public
testGetMyProfile() : void
Return values
void —testGetMyTransactions()
Test transaction retrieval
public
testGetMyTransactions() : void
Return values
void —testMissingConfiguration()
Test that driver complains about missing configuration.
public
testMissingConfiguration() : void
Return values
void —testPatronLogin()
Test patron login
public
testPatronLogin() : void
Return values
void —testTokenAutoRenewal()
Test token auto-renewal
public
testTokenAutoRenewal() : void
Return values
void —expectConsecutiveCalls()
Expect consecutive calls to a mock.
protected
expectConsecutiveCalls(MockObject $mock, string $method, array<string|int, mixed> $expectedCalls[, mixed $returnValues = null ]) : InvocationStubber
Parameters
- $mock : MockObject
-
Mock object
- $method : string
-
Method expecting calls
- $expectedCalls : array<string|int, mixed>
-
Expected input parameters
- $returnValues : mixed = null
-
Return values to mock (either an array indexed parallel to $expectedCalls to return different values, or a single value to always return the same thing)
Return values
InvocationStubber —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
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
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> —getMockResponse()
Get a mock response with a predetermined body.
protected
getMockResponse(string $body[, int $status = 200 ]) : Response
Parameters
- $body : string
-
Body
- $status : int = 200
-
HTTP status code
Return values
Response —setUpHoldingTest()
Configure the driver to respond to a getHolding() call.
protected
setUpHoldingTest() : void