CursorMarkIdFetcherTest
extends TestCase
in package
Uses
WithConsecutiveTrait
CursorMarkIdFetcher Test Class
Tags
Table of Contents
- $backendId : string
- Backend ID to use in tests
- $countPerPage : int
- Page size to use in tests
- $uniqueKey : string
- Unique key field to use in tests
- testFetching() : void
- Test the cursor-mark ID retrieval process.
- testSetupBackend() : void
- Test that calling the setupBackend method runs the SetRecordCollectionFactoryCommand.
- testWithFilters() : void
- Test passing filters.
- addRecordsToCollection() : array<string|int, int>
- Add mock records to a collection and return an array of the generated IDs.
- expectConsecutiveCalls() : InvocationStubber
- Expect consecutive calls to a mock.
- getIdsExpectation() : callable
- Get a function to test that a GetIdsCommand is as expected.
- getMockKeyCommand() : MockObject|GetUniqueKeyCommand
- Get a mock "GetUniqueKeyCommand" for testing purposes.
- getMockService() : MockObject|Service
- Get a mock search service
Properties
$backendId
Backend ID to use in tests
protected
string
$backendId
= 'foo'
$countPerPage
Page size to use in tests
protected
int
$countPerPage
= 100
$uniqueKey
Unique key field to use in tests
protected
string
$uniqueKey
= 'id'
Methods
testFetching()
Test the cursor-mark ID retrieval process.
public
testFetching() : void
Return values
void —testSetupBackend()
Test that calling the setupBackend method runs the SetRecordCollectionFactoryCommand.
public
testSetupBackend() : void
Return values
void —testWithFilters()
Test passing filters.
public
testWithFilters() : void
Return values
void —addRecordsToCollection()
Add mock records to a collection and return an array of the generated IDs.
protected
addRecordsToCollection(RecordCollection $records, int $offset[, string|null $lastMod = null ]) : array<string|int, int>
Parameters
- $records : RecordCollection
-
Collection to add to
- $offset : int
-
Offset for records
- $lastMod : string|null = null
-
Last modification date (optional)
Return values
array<string|int, int> —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 —getIdsExpectation()
Get a function to test that a GetIdsCommand is as expected.
protected
getIdsExpectation(string $expectedCursorMark[, array<string|int, string> $expectedFq = [] ]) : callable
Parameters
- $expectedCursorMark : string
-
Expected cursor mark
- $expectedFq : array<string|int, string> = []
-
Expected filter query
Return values
callable —getMockKeyCommand()
Get a mock "GetUniqueKeyCommand" for testing purposes.
protected
getMockKeyCommand() : MockObject|GetUniqueKeyCommand
Return values
MockObject|GetUniqueKeyCommand —getMockService()
Get a mock search service
protected
getMockService() : MockObject|Service