VuFind API Documentation

SimilarItemsTest extends TestCase
in package
Uses WithConsecutiveTrait

SimilarItems Test Class

Tags
category

VuFind

author

Sudharma Kellampalli skellamp@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

configureTestTargetAndExpectations()  : array<string|int, mixed>
Support method to mock objects.
testGetFromRecord()  : void
Test deriving channel information from a record driver object.
testGetFromRecordWhenChannelTokenIsSet()  : void
Test deriving channel information from a record driver object when we have a token that do not match record driver.
testGetFromSearch()  : void
Test deriving channel information from a search results object.
testGetFromSearchWhenChannelsIsEmpty()  : void
Test deriving channel information from a search results object with a specific single channel to load.
testGetFromSearchWhenMaxRecordsIsLessthanChannels()  : void
Test deriving channel information from a search results object when maxRecordsToExamine is lessthan channels.
expectConsecutiveCalls()  : InvocationStubber
Expect consecutive calls to a mock.
getCommandChecker()  : callable
Support method to test callbacks.
getDriver()  : TestHarness
Get a fake record driver
getSimilarItems()  : array<string|int, mixed>
Get SimilarItems mock object

Methods

configureTestTargetAndExpectations()

Support method to mock objects.

public configureTestTargetAndExpectations([array<string|int, mixed> $options = ['maxRecordsToExamine' => 1] ][, bool $fetchFromSearchService = false ]) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed> = ['maxRecordsToExamine' => 1]

Set options for the provider

$fetchFromSearchService : bool = false

Flag indicating test case to fetch from search service when the search results do not include object we are looking for

Return values
array<string|int, mixed>

testGetFromRecord()

Test deriving channel information from a record driver object.

public testGetFromRecord() : void
Return values
void

testGetFromRecordWhenChannelTokenIsSet()

Test deriving channel information from a record driver object when we have a token that do not match record driver.

public testGetFromRecordWhenChannelTokenIsSet() : void
Return values
void

testGetFromSearch()

Test deriving channel information from a search results object.

public testGetFromSearch() : void
Return values
void

testGetFromSearchWhenChannelsIsEmpty()

Test deriving channel information from a search results object with a specific single channel to load.

public testGetFromSearchWhenChannelsIsEmpty() : void
Return values
void

testGetFromSearchWhenMaxRecordsIsLessthanChannels()

Test deriving channel information from a search results object when maxRecordsToExamine is lessthan channels.

public testGetFromSearchWhenMaxRecordsIsLessthanChannels() : 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

getCommandChecker()

Support method to test callbacks.

protected getCommandChecker([array<string|int, mixed> $args = [] ][, string $class = VuFindSearchCommandSimilarCommand::class ][, string $target = 'Solr' ]) : callable
Parameters
$args : array<string|int, mixed> = []

Command arguments

$class : string = VuFindSearchCommandSimilarCommand::class

Command class

$target : string = 'Solr'

Target identifier

Return values
callable

getSimilarItems()

Get SimilarItems mock object

protected getSimilarItems([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed> = []

options for the provider

Return values
array<string|int, mixed>

Search results