SearchServiceTest
extends TestCase
in package
Uses
WithConsecutiveTrait
Unit tests for search service.
Tags
Table of Contents
- $backend : BackendInterface
- Mock backend
- testFailedResolveWithCommand() : void
- Test a failure to resolve using a command object.
- testInvoke() : void
- Test invoke action.
- testInvokeException() : void
- Test exception-throwing invoke action.
- createMockBackend() : object
- Create a mock backend.
- expectConsecutiveCalls() : InvocationStubber
- Expect consecutive calls to a mock.
- getBackend() : BackendInterface
- Get a mock backend.
- getService() : Service
- Generate a fake service.
Properties
$backend
Mock backend
protected
BackendInterface
$backend
= false
Methods
testFailedResolveWithCommand()
Test a failure to resolve using a command object.
public
testFailedResolveWithCommand() : void
Return values
void —testInvoke()
Test invoke action.
public
testInvoke() : void
Return values
void —testInvokeException()
Test exception-throwing invoke action.
public
testInvokeException() : void
Return values
void —createMockBackend()
Create a mock backend.
protected
createMockBackend([string $class = VuFindSearchBackendBackendInterface::class ][, string $identifier = 'foo' ]) : object
Parameters
- $class : string = VuFindSearchBackendBackendInterface::class
-
Class to build
- $identifier : string = 'foo'
-
Backend ID to use
Return values
object —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 —getBackend()
Get a mock backend.
protected
getBackend() : BackendInterface
Return values
BackendInterface —getService()
Generate a fake service.
protected
getService() : Service