LoaderTest
extends TestCase
in package
Uses
WithConsecutiveTrait
Record loader tests.
Tags
Table of Contents
- testBatchLoad() : void
- Test batch load.
- testBatchLoadWithFallback() : void
- Test batch load with fallback loader.
- testMissingRecord() : void
- Test exception for missing record.
- testMissingRecordWithFallback() : void
- Test that the fallback loader gets called successfully for a missing record.
- testSingleRecord() : void
- Test single record.
- testSingleRecordWithBackendParameters() : void
- Test single record with backend parameters.
- testToleratedMissingRecord() : void
- Test "tolerate missing records" feature.
- expectConsecutiveCalls() : InvocationStubber
- Expect consecutive calls to a mock.
- getCollection() : RecordCollectionInterface
- Get a fake record collection.
- getCommandChecker() : callable
- Support method to test callbacks.
- getDriver() : AbstractBase
- Get test record driver object
- getFallbackLoader() : PluginManager
- Get a fallback loader (currently assumes Summon plugin will be used).
- getLoader() : Loader
- Build a loader to test.
Methods
testBatchLoad()
Test batch load.
public
testBatchLoad() : void
Return values
void —testBatchLoadWithFallback()
Test batch load with fallback loader.
public
testBatchLoadWithFallback() : void
Return values
void —testMissingRecord()
Test exception for missing record.
public
testMissingRecord() : void
Return values
void —testMissingRecordWithFallback()
Test that the fallback loader gets called successfully for a missing record.
public
testMissingRecordWithFallback() : void
Return values
void —testSingleRecord()
Test single record.
public
testSingleRecord() : void
Return values
void —testSingleRecordWithBackendParameters()
Test single record with backend parameters.
public
testSingleRecordWithBackendParameters() : void
Return values
void —testToleratedMissingRecord()
Test "tolerate missing records" feature.
public
testToleratedMissingRecord() : 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 —getCollection()
Get a fake record collection.
protected
getCollection(array<string|int, mixed> $records) : RecordCollectionInterface
Parameters
- $records : array<string|int, mixed>
-
Record(s) to retrieve
Return values
RecordCollectionInterface —getCommandChecker()
Support method to test callbacks.
protected
getCommandChecker([array<string|int, mixed> $args = [] ][, string $class = VuFindSearchCommandRetrieveCommand::class ][, string $target = 'Solr' ]) : callable
Parameters
- $args : array<string|int, mixed> = []
-
Command arguments
- $class : string = VuFindSearchCommandRetrieveCommand::class
-
Command class
- $target : string = 'Solr'
-
Target identifier
Return values
callable —getDriver()
Get test record driver object
protected
getDriver([string $id = 'test' ][, string $source = 'Solr' ]) : AbstractBase
Parameters
- $id : string = 'test'
-
Record ID
- $source : string = 'Solr'
-
Record source
Return values
AbstractBase —getFallbackLoader()
Get a fallback loader (currently assumes Summon plugin will be used).
protected
getFallbackLoader(array<string|int, mixed> $records) : PluginManager
Parameters
- $records : array<string|int, mixed>
-
Records to return from the fallback plugin
Return values
PluginManager —getLoader()
Build a loader to test.
protected
getLoader(Service $service[, PluginManager $factory = null ][, Cache $recordCache = null ][, PluginManager $fallbackLoader = null ]) : Loader
Parameters
- $service : Service
-
Search service
- $factory : PluginManager = null
-
Record factory (optional)
- $recordCache : Cache = null
-
Record Cache
- $fallbackLoader : PluginManager = null
-
Fallback record loader