VuFind API Documentation

BackendTest extends TestCase
in package
Uses FixtureTrait, WithConsecutiveTrait

Unit tests for Summon Backend class.

Tags
category

VuFind

author

David Maus maus@hab.de

license

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

link
https://vufind.org

Table of Contents

testConstructorSetters()  : void
Test setting a custom record collection factory.
testMergedParamBag()  : void
Test merged param bag.
testRetrieve()  : void
Test retrieving a record.
testRetrieveBatch()  : void
Test retrieving multiple records.
testRetrieveWrapsSummonException()  : void
Test retrieve exception handling.
testSearch()  : void
Test performing a search.
testSearchWrapsSummonException()  : void
Test search exception handling.
testSetQueryBuilder()  : void
Test setting a query builder.
expectConsecutiveCalls()  : InvocationStubber
Expect consecutive calls to a mock.
getConnectorMock()  : array<string|int, mixed>
Return connector 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).
loadResponse()  : mixed
Load a Summon response as fixture.
setUp()  : void
Setup method.

Methods

testConstructorSetters()

Test setting a custom record collection factory.

public testConstructorSetters() : void
Return values
void

testMergedParamBag()

Test merged param bag.

public testMergedParamBag() : void
Return values
void

testRetrieve()

Test retrieving a record.

public testRetrieve() : void
Return values
void

testRetrieveBatch()

Test retrieving multiple records.

public testRetrieveBatch() : void
Return values
void

testRetrieveWrapsSummonException()

Test retrieve exception handling.

public testRetrieveWrapsSummonException() : void
Return values
void

testSearch()

Test performing a search.

public testSearch() : void
Return values
void

testSearchWrapsSummonException()

Test search exception handling.

public testSearchWrapsSummonException() : void
Return values
void

testSetQueryBuilder()

Test setting a query builder.

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

getConnectorMock()

Return connector mock.

protected getConnectorMock([array<string|int, mixed> $mock = [] ]) : array<string|int, mixed>
Parameters
$mock : array<string|int, mixed> = []

Functions to mock

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>

loadResponse()

Load a Summon response as fixture.

protected loadResponse(string $fixture) : mixed
Parameters
$fixture : string

Fixture file

Tags
throws
InvalidArgumentException

Fixture files does not exist

Return values
mixed

setUp()

Setup method.

protected setUp() : void
Return values
void

Search results