VuFind API Documentation

ResultsTest extends TestCase
in package
Uses ConfigPluginManagerTrait, TranslatorTrait

Solr Search Object Results Test

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

Ere Maijala ere.maijala@helsinki.fi

license

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

link

Wiki

Table of Contents

$searchConfig  : array<string|int, mixed>
Default faceted search configuration
$searchResponse  : array<string|int, mixed>
Default faceted search response
testCursorMark()  : void
Test CursorMark functionality.
testFacetTranslations()  : void
Test facet translation functionality.
testGetFacetList()  : void
Test retrieving facets.
testGetResultTotal()  : void
Test retrieving a result count.
testMissingHierarchicalFacetHelper()  : void
Test exception from missing hierarchical facet helper
testMissingSorter()  : void
Test exception from missing sorter
testSpellingProcessor()  : void
Test spelling processor support.
getMockConfigPluginManager()  : MockObject|PluginManager
Get a mock configuration plugin manager with the given configuration "files" available.
getMockFailingConfigPluginManager()  : MockObject|PluginManager
Get a mock configuration plugin manager that will throw an exception.
getMockTranslator()  : TranslatorInterface
Get mock translator.
getParams()  : Params
Get Params object
getResults()  : Results
Get Results object
getResultsFromResponse()  : Results
Get a Results objects from a response array.
getSearchServiceWithMockSearchMethod()  : Service
Get a mock search service that will return a RecordCollection.

Properties

$searchConfig

Default faceted search configuration

protected array<string|int, mixed> $searchConfig = ['facets' => ['SpecialFacets' => ['hierarchical' => ['building'], 'hierarchicalFacetSortOptions' => ['building' => 'top']]]]

$searchResponse

Default faceted search response

protected array<string|int, mixed> $searchResponse = ['response' => ['numFound' => 5], 'facet_counts' => ['facet_fields' => ['topic_facet' => [['Research', 16], ['Psychotherapy', 8]], 'building' => [['0/Main/', 11], ['1/Main/Fiction/', 5], ['0/Sub/', 2]]]]]

Methods

testCursorMark()

Test CursorMark functionality.

public testCursorMark() : void
Return values
void

testFacetTranslations()

Test facet translation functionality.

public testFacetTranslations() : void
Return values
void

testGetFacetList()

Test retrieving facets.

public testGetFacetList() : void
Return values
void

testGetResultTotal()

Test retrieving a result count.

public testGetResultTotal() : void
Return values
void

testMissingHierarchicalFacetHelper()

Test exception from missing hierarchical facet helper

public testMissingHierarchicalFacetHelper() : void
Return values
void

testMissingSorter()

Test exception from missing sorter

public testMissingSorter() : void
Return values
void

testSpellingProcessor()

Test spelling processor support.

public testSpellingProcessor() : void
Return values
void

getMockConfigPluginManager()

Get a mock configuration plugin manager with the given configuration "files" available.

protected getMockConfigPluginManager(array<string|int, mixed> $configs[, array<string|int, mixed> $default = [] ][, InvocationOrder|null $getExpect = null ][, InvocationOrder|null $hasExpect = null ]) : MockObject|PluginManager
Parameters
$configs : array<string|int, mixed>

An associative array of configurations where key is the file (e.g. 'config') and value an array of configuration sections and directives

$default : array<string|int, mixed> = []

Default configuration to return when no entry is found in $configs

$getExpect : InvocationOrder|null = null

The expected invocation order for the get() method (null for any)

$hasExpect : InvocationOrder|null = null

The expected invocation order for the has() method (null for any)

Return values
MockObject|PluginManager

getMockFailingConfigPluginManager()

Get a mock configuration plugin manager that will throw an exception.

protected getMockFailingConfigPluginManager(Throwable $exception) : MockObject|PluginManager
Parameters
$exception : Throwable

Exception to throw

Return values
MockObject|PluginManager

getMockTranslator()

Get mock translator.

protected getMockTranslator(array<string|int, mixed> $translations[, string $locale = 'en' ]) : TranslatorInterface
Parameters
$translations : array<string|int, mixed>

Key => value translation map.

$locale : string = 'en'

Locale, default to 'en'

Return values
TranslatorInterface

getResults()

Get Results object

protected getResults([Params $params = null ][, Service $searchService = null ][, Loader $loader = null ]) : Results
Parameters
$params : Params = null

Params object

$searchService : Service = null

Search service

$loader : Loader = null

Record loader

Return values
Results

getResultsFromResponse()

Get a Results objects from a response array.

protected getResultsFromResponse([array<string|int, mixed>|null $response = null ][, Params|null $params = null ]) : Results

Note that this returns the response for a search request without validating the request.

Parameters
$response : array<string|int, mixed>|null = null

Solr response array or null for default

$params : Params|null = null

Params or null for default

Return values
Results

getSearchServiceWithMockSearchMethod()

Get a mock search service that will return a RecordCollection.

protected getSearchServiceWithMockSearchMethod(array<string|int, mixed> $response, array<string|int, mixed> $expectedParams) : Service
Parameters
$response : array<string|int, mixed>

Decoded Solr response for search to return

$expectedParams : array<string|int, mixed>

Expected ParamBag parameters

Return values
Service

Search results