BackendTest
extends TestCase
in package
Uses
FixtureTrait, ReflectionTrait
Unit tests for Pazpar2 backend.
Tags
Table of Contents
- testGetConnector() : void
- Test that getConnector works.
- testSearch() : void
- Test performing a search.
- testSetMaxQueryTime() : void
- Test setter.
- testSetSearchProgressTarget() : void
- Test setter.
- callMethod() : mixed
- Call protected or private method for side-effect and result.
- 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).
- getProperty() : mixed
- Return protected or private property.
- getStatXml() : string
- Get a fake stat response.
- loadResponse() : mixed
- Load a response as fixture.
- setProperty() : void
- Set protected or private property.
Methods
testGetConnector()
Test that getConnector works.
public
testGetConnector() : void
Return values
void —testSearch()
Test performing a search.
public
testSearch() : void
Return values
void —testSetMaxQueryTime()
Test setter.
public
testSetMaxQueryTime() : void
Return values
void —testSetSearchProgressTarget()
Test setter.
public
testSetSearchProgressTarget() : 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 —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
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 —getStatXml()
Get a fake stat response.
protected
getStatXml(float $progress) : string
Parameters
- $progress : float
-
How far?
Return values
string —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