BackendTest
extends TestCase
in package
Uses
FixtureTrait, ReflectionTrait
Unit tests for SOLR backend.
Tags
Table of Contents
- getIdsProvider() : array<string|int, mixed>
- Data provider for testGetIds
- testBadJson() : void
- Test handling of a bad JSON response.
- testExtraRequestDetails() : void
- Test extra request details
- testFacets() : void
- Test facets.
- testGetConnector() : void
- Test getting a connector.
- testGetIdentifier() : void
- Test getting an identifier.
- testGetIds() : void
- Test getting multiple IDs.
- testInjectResponseWriterThrownOnIncompabileNamedListSetting() : void
- Test injectResponseWriter throws on incompatible named list setting.
- testInjectResponseWriterThrownOnIncompabileResponseWriter() : void
- Test injectResponseWriter throws on incompatible response writer.
- testPivotFacets() : void
- Test pivot facets.
- testQueryFacets() : void
- Test query facets.
- testRandom() : void
- Test random method
- testRefineAlphaBrowseException() : void
- Test refining an alphabrowse exception (string 1).
- testRefineAlphaBrowseExceptionWithAltString() : void
- Test refining an alphabrowse exception (string 2).
- testRefineAlphaBrowseExceptionWithNonBrowseString() : void
- Test that we don't refine a non-alphabrowse-related exception.
- testResetExtraRequestDetails() : void
- Test reset extra request details
- testRetrieve() : void
- Test retrieving a record.
- testRetrieveBatch() : void
- Test retrieving a batch of records.
- testRetrieveBatchWithNonDefaultPageSize() : void
- Test retrieving a batch of records, using a non-default page size.
- testSimilar() : void
- Test retrieving similar records.
- testTerms() : void
- Test terms component.
- testTermsWithParamBagAsFirstParameter() : void
- Test terms component (using ParamBag as first param).
- testWriteDocument() : void
- Test writeDocument
- callMethod() : mixed
- Call protected or private method for side-effect and result.
- getConnectorMock() : MockObject|Connector
- 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.
- loadResponse() : Response
- Load a SOLR response as fixture.
- runRefineExceptionCall() : void
- Support method to run a "refine exception" test.
- runRetrieveBatchTests() : void
- Given a configured backend, run some standard tests (this allows us to test two different versions of the same scenario.
- setProperty() : void
- Set protected or private property.
Methods
getIdsProvider()
Data provider for testGetIds
public
static getIdsProvider() : array<string|int, mixed>
Return values
array<string|int, mixed> —testBadJson()
Test handling of a bad JSON response.
public
testBadJson() : void
Return values
void —testExtraRequestDetails()
Test extra request details
public
testExtraRequestDetails() : void
Return values
void —testFacets()
Test facets.
public
testFacets() : void
Return values
void —testGetConnector()
Test getting a connector.
public
testGetConnector() : void
Return values
void —testGetIdentifier()
Test getting an identifier.
public
testGetIdentifier() : void
Return values
void —testGetIds()
Test getting multiple IDs.
public
testGetIds(string|null $flIn, string $expectedFlOut) : void
Parameters
- $flIn : string|null
-
Additional field list in input (null = none)
- $expectedFlOut : string
-
Expected field list in output
Tags
Return values
void —testInjectResponseWriterThrownOnIncompabileNamedListSetting()
Test injectResponseWriter throws on incompatible named list setting.
public
testInjectResponseWriterThrownOnIncompabileNamedListSetting() : void
Return values
void —testInjectResponseWriterThrownOnIncompabileResponseWriter()
Test injectResponseWriter throws on incompatible response writer.
public
testInjectResponseWriterThrownOnIncompabileResponseWriter() : void
Return values
void —testPivotFacets()
Test pivot facets.
public
testPivotFacets() : void
Return values
void —testQueryFacets()
Test query facets.
public
testQueryFacets() : void
Return values
void —testRandom()
Test random method
public
testRandom() : void
Return values
void —testRefineAlphaBrowseException()
Test refining an alphabrowse exception (string 1).
public
testRefineAlphaBrowseException() : void
Return values
void —testRefineAlphaBrowseExceptionWithAltString()
Test refining an alphabrowse exception (string 2).
public
testRefineAlphaBrowseExceptionWithAltString() : void
Return values
void —testRefineAlphaBrowseExceptionWithNonBrowseString()
Test that we don't refine a non-alphabrowse-related exception.
public
testRefineAlphaBrowseExceptionWithNonBrowseString() : void
Return values
void —testResetExtraRequestDetails()
Test reset extra request details
public
testResetExtraRequestDetails() : void
Return values
void —testRetrieve()
Test retrieving a record.
public
testRetrieve() : void
Return values
void —testRetrieveBatch()
Test retrieving a batch of records.
public
testRetrieveBatch() : void
Return values
void —testRetrieveBatchWithNonDefaultPageSize()
Test retrieving a batch of records, using a non-default page size.
public
testRetrieveBatchWithNonDefaultPageSize() : void
Return values
void —testSimilar()
Test retrieving similar records.
public
testSimilar() : void
Return values
void —testTerms()
Test terms component.
public
testTerms() : void
Return values
void —testTermsWithParamBagAsFirstParameter()
Test terms component (using ParamBag as first param).
public
testTermsWithParamBagAsFirstParameter() : void
Return values
void —testWriteDocument()
Test writeDocument
public
testWriteDocument() : 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 = [] ][, HttpClient $client = null ]) : MockObject|Connector
Parameters
- $mock : array<string|int, mixed> = []
-
Functions to mock
- $client : HttpClient = null
-
HTTP Client (optional)
Return values
MockObject|Connector —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 —loadResponse()
Load a SOLR response as fixture.
protected
loadResponse(string $fixture) : Response
Parameters
- $fixture : string
-
Fixture file
Tags
Return values
Response —runRefineExceptionCall()
Support method to run a "refine exception" test.
protected
runRefineExceptionCall(string $msg) : void
Parameters
- $msg : string
-
Error message
Return values
void —runRetrieveBatchTests()
Given a configured backend, run some standard tests (this allows us to test two different versions of the same scenario.
protected
runRetrieveBatchTests(Backend $back) : void
Parameters
- $back : Backend
-
Backend
Return values
void —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