BackendTest
extends TestCase
in package
Uses
FixtureTrait, ReflectionTrait
Unit tests for EDS backend.
Tags
Table of Contents
- testAutocomplete() : void
- Test performing an autocomplete
- testConstructorSetters() : void
- Test setting a custom record collection factory.
- testRetrieveEdsItem() : void
- Test retrieving an EDS record.
- testRetrieveEpfItem() : void
- Test retrieving an EPF record.
- testSearch() : void
- Test performing a search.
- testSetQueryBuilder() : void
- Test setting a query builder.
- callMethod() : mixed
- Call protected or private method for side-effect and result.
- getBackend() : Backend
- Return backend
- getConnectorMock() : array<string|int, mixed>
- Return connector mock.
- getEdsRCFactory() : RecordCollectionFactory
- Build a real record collection factory for EDS records
- getEpfRCFactory() : RecordCollectionFactory
- Build a real record collection factory for EPF records
- 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.
- getRCFactory() : RecordCollectionFactory
- Build a real record collection factory
- loadResponse() : mixed
- Load a response as fixture.
- setProperty() : void
- Set protected or private property.
Methods
testAutocomplete()
Test performing an autocomplete
public
testAutocomplete() : void
Return values
void —testConstructorSetters()
Test setting a custom record collection factory.
public
testConstructorSetters() : void
Return values
void —testRetrieveEdsItem()
Test retrieving an EDS record.
public
testRetrieveEdsItem() : void
Return values
void —testRetrieveEpfItem()
Test retrieving an EPF record.
public
testRetrieveEpfItem() : void
Return values
void —testSearch()
Test performing a search.
public
testSearch() : void
Return values
void —testSetQueryBuilder()
Test setting a query builder.
public
testSetQueryBuilder() : void
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
Return values
mixed —getBackend()
Return backend
protected
getBackend(Connector $connector[, RecordCollectionFactoryInterface $factory = null ][, StorageInterface $cache = null ][, Container $container = null ][, array<string|int, mixed> $settings = [] ][, array<string|int, mixed> $mock = null ]) : Backend
Parameters
- $connector : Connector
-
Connector
- $factory : RecordCollectionFactoryInterface = null
-
Record collection factory
- $cache : StorageInterface = null
-
Object cache adapter
- $container : Container = null
-
Session container
- $settings : array<string|int, mixed> = []
-
Additional settings
- $mock : array<string|int, mixed> = null
-
Methods to mock (or null for a real object)
Return values
Backend —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> —getEdsRCFactory()
Build a real record collection factory for EDS records
protected
getEdsRCFactory() : RecordCollectionFactory
Return values
RecordCollectionFactory —getEpfRCFactory()
Build a real record collection factory for EPF records
protected
getEpfRCFactory() : RecordCollectionFactory
Return values
RecordCollectionFactory —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> —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
Return values
mixed —getRCFactory()
Build a real record collection factory
protected
getRCFactory(string $driverClass) : RecordCollectionFactory
Parameters
- $driverClass : string
-
class of the RecordDriver to create
Return values
RecordCollectionFactory —loadResponse()
Load a response as fixture.
protected
loadResponse(string $fixture) : mixed
Parameters
- $fixture : string
-
Fixture file
Tags
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