VuFind API Documentation

AlmaTest extends ILSDriverTestCase
in package
Uses FixtureTrait

Alma ILS driver test

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

Ere Maijala ere.maijala@helsinki.fi

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  : AbstractBase
ILS driver
$fixtureSteps  : array<string|int, mixed>
Test data for simulated HTTP responses (reset by each test)
mockMakeRequest()  : null|SimpleXMLElement
Replace makeRequest to inject test returns
setUp()  : void
Standard setup method.
testGetHolding()  : void
Test getHolding
testGetHoldingWithMappings()  : void
Test getHolding with location type to item status mappings
testMissingConfiguration()  : void
Test that driver complains about missing configuration.
convertTranslatableStrings()  : array<string|int, mixed>
Convert TranslatableString instances for easier comparison
createConnector()  : void
Generate a new driver to return responses set in a json fixture
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).

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 = ['Catalog' => ['apiBaseUrl' => 'http://localhost/v1', 'apiKey' => 'key123']]

$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 $path[, array<string|int, mixed> $paramsGet = [] ][, array<string|int, mixed> $paramsPost = [] ][, string $method = 'GET' ][, string $rawBody = null ][, Headers|array<string|int, mixed> $headers = null ][, array<string|int, mixed> $allowedErrors = [] ][, bool $returnStatus = false ]) : null|SimpleXMLElement
Parameters
$path : string

Path to retrieve from API (excluding base URL/API key)

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

Additional GET params

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

Additional POST params

$method : string = 'GET'

GET or POST. Default is GET.

$rawBody : string = null

Request body.

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

Add headers to the call.

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

HTTP status codes that are not treated as API errors.

$returnStatus : bool = false

Whether to return HTTP status in addition to the response.

Return values
null|SimpleXMLElement

setUp()

Standard setup method.

public setUp() : void
Return values
void

testGetHolding()

Test getHolding

public testGetHolding() : void
Return values
void

testGetHoldingWithMappings()

Test getHolding with location type to item status mappings

public testGetHoldingWithMappings() : void
Return values
void

testMissingConfiguration()

Test that driver complains about missing configuration.

public testMissingConfiguration() : void
Return values
void

convertTranslatableStrings()

Convert TranslatableString instances for easier comparison

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

Array to process

Return values
array<string|int, mixed>

createConnector()

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

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

Overwrites $this->driver

Parameters
$test : string

Name of test fixture to load

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

Driver configuration (null to use default)

Return values
void

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>

Search results