TermsIdFetcherTest
extends TestCase
in package
Uses
WithConsecutiveTrait
GetIdsWithTermsCommand Test Class
Tags
Table of Contents
- $countPerPage : int
- Page size to use in tests
- $uniqueKey : string
- Unique key field to use in tests
- testFetching() : void
- Test the terms retrieval process.
- testFilters() : void
- Test that filters are unsupported.
- expectConsecutiveCalls() : InvocationStubber
- Expect consecutive calls to a mock.
- getIdsExpectation() : callable
- Get a function to test that a TermsCommand is as expected.
- getMockKeyCommand() : GetUniqueKeyCommand
- Get a mock "GetUniqueKeyCommand" for testing purposes.
- getMockService() : Service
- Get mock search service
- getMockTermsCommand() : TermsCommand
- Get a mock "TermsCommand" to use as a container for a test value.
- getTermsResponse() : Terms
- Get a terms response
Properties
$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 terms retrieval process.
public
testFetching() : void
Return values
void —testFilters()
Test that filters are unsupported.
public
testFilters() : 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 —getIdsExpectation()
Get a function to test that a TermsCommand is as expected.
protected
getIdsExpectation(string $expectedCursorMark) : callable
Parameters
- $expectedCursorMark : string
-
Expected cursor mark
Return values
callable —getMockKeyCommand()
Get a mock "GetUniqueKeyCommand" for testing purposes.
protected
getMockKeyCommand() : GetUniqueKeyCommand
Return values
GetUniqueKeyCommand —getMockService()
Get mock search service
protected
getMockService() : Service
Return values
Service —getMockTermsCommand()
Get a mock "TermsCommand" to use as a container for a test value.
protected
getMockTermsCommand(Terms $terms) : TermsCommand
Parameters
- $terms : Terms
-
Terms response
Return values
TermsCommand —getTermsResponse()
Get a terms response
protected
getTermsResponse(array<string|int, int> $expectedIds) : Terms
Parameters
- $expectedIds : array<string|int, int>
-
IDs to return in response