SpellingProcessorTest
extends TestCase
in package
Uses
FixtureTrait, ReflectionTrait, SolrSearchObjectTrait
Unit tests for spelling processor.
Tags
Table of Contents
- getMockConfigManager() : PluginManager
- Get mock config manager.
- getSolrOptions() : Options
- Get Solr options.
- getSolrParams() : Params
- Get Solr params.
- getSolrResults() : Results
- Get Solr results.
- testAdvancedQuerySuggestions() : void
- Test an advanced search -- this is important because advanced searches sometimes generate false positive phrase suggestions due to the way flattened spelling queries are created; this test exercises the code that fails over to a secondary query when the main query fails to turn up any relevant suggestions.
- testBasicSuggestions() : void
- Test basic suggestions.
- testBasicSuggestionsForUppercaseQuery() : void
- Test basic suggestions for an uppercase query.
- testBasicSuggestionsWithNonDefaultSettings() : void
- Test basic suggestions with expansions disabled and phrase display on.
- testDefaultConfigs() : void
- Test defaults.
- testDetectionOfMissingExtendedResultsSetting() : void
- Test detection of bad Solr response format.
- testNonDefaultConfigs() : void
- Test non-default configs.
- testNumericExclusion() : void
- Test exclusion of numeric terms.
- testNumericInclusion() : void
- Test inclusion of numeric terms.
- testShingleSuggestion() : void
- Test a shingle suggestion.
- testSpellingTokenization() : void
- Test that spelling tokenization works correctly.
- testSuggestionProcessing() : void
- Test suggestion processing.
- testSuggestionProcessingWithNonDefaultLimit() : void
- Test suggestion processing.
- callMethod() : mixed
- Call protected or private method for side-effect and result.
- getExpectedQuery1Suggestions() : array<string|int, mixed>
- Get expected suggestions for the "query1" example.
- getExpectedQuery6Suggestions() : array<string|int, mixed>
- Get expected suggestions for the "query6" example.
- getFixture() : string
- Load a fixture file.
- getFixtureDir() : string
- Get the base directory containing fixtures.
- getFixturePath() : string
- Resolve fixture path.
- getJsonFixture() : array<string|int, mixed>
- Load a JSON fixture from file (using associative array return type).
- getProperty() : mixed
- Return protected or private property.
- runSpellingTest() : void
- Generic test.
- setProperty() : void
- Set protected or private property.
- unserializeFixture() : mixed
- Get a fixture object
Methods
getMockConfigManager()
Get mock config manager.
public
getMockConfigManager() : PluginManager
Return values
PluginManager —getSolrOptions()
Get Solr options.
public
getSolrOptions() : Options
Return values
Options —getSolrParams()
Get Solr params.
public
getSolrParams([Options $options = null ]) : Params
Parameters
- $options : Options = null
-
Solr options to inject (null for default)
Return values
Params —getSolrResults()
Get Solr results.
public
getSolrResults([Params $params = null ]) : Results
Parameters
- $params : Params = null
-
Solr parameters to inject (null for default)
Return values
Results —testAdvancedQuerySuggestions()
Test an advanced search -- this is important because advanced searches sometimes generate false positive phrase suggestions due to the way flattened spelling queries are created; this test exercises the code that fails over to a secondary query when the main query fails to turn up any relevant suggestions.
public
testAdvancedQuerySuggestions() : void
Return values
void —testBasicSuggestions()
Test basic suggestions.
public
testBasicSuggestions() : void
Return values
void —testBasicSuggestionsForUppercaseQuery()
Test basic suggestions for an uppercase query.
public
testBasicSuggestionsForUppercaseQuery() : void
Return values
void —testBasicSuggestionsWithNonDefaultSettings()
Test basic suggestions with expansions disabled and phrase display on.
public
testBasicSuggestionsWithNonDefaultSettings() : void
Return values
void —testDefaultConfigs()
Test defaults.
public
testDefaultConfigs() : void
Return values
void —testDetectionOfMissingExtendedResultsSetting()
Test detection of bad Solr response format.
public
testDetectionOfMissingExtendedResultsSetting() : void
Return values
void —testNonDefaultConfigs()
Test non-default configs.
public
testNonDefaultConfigs() : void
Return values
void —testNumericExclusion()
Test exclusion of numeric terms.
public
testNumericExclusion() : void
Return values
void —testNumericInclusion()
Test inclusion of numeric terms.
public
testNumericInclusion() : void
Return values
void —testShingleSuggestion()
Test a shingle suggestion.
public
testShingleSuggestion() : void
Return values
void —testSpellingTokenization()
Test that spelling tokenization works correctly.
public
testSpellingTokenization() : void
Return values
void —testSuggestionProcessing()
Test suggestion processing.
public
testSuggestionProcessing() : void
Return values
void —testSuggestionProcessingWithNonDefaultLimit()
Test suggestion processing.
public
testSuggestionProcessingWithNonDefaultLimit() : void
Return values
void —callMethod()
Call protected or private method for side-effect and result.
protected
callMethod(object|string $object, string $method[, array<string|int, mixed> $arguments = [] ]) : mixed
Uses PHP's reflection API in order to modify method accessibility.
Parameters
- $object : object|string
-
Object or class name
- $method : string
-
Method name
- $arguments : array<string|int, mixed> = []
-
Method arguments
Tags
Return values
mixed —getExpectedQuery1Suggestions()
Get expected suggestions for the "query1" example.
protected
getExpectedQuery1Suggestions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getExpectedQuery6Suggestions()
Get expected suggestions for the "query6" example.
protected
getExpectedQuery6Suggestions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFixture()
Load a fixture file.
protected
getFixture(string $filename[, string $module = 'VuFind' ]) : string
Parameters
- $filename : string
-
Filename relative to fixture directory.
- $module : string = 'VuFind'
-
Module containing fixture.
Tags
Return values
string —getFixtureDir()
Get the base directory containing fixtures.
protected
getFixtureDir([string $module = 'VuFind' ]) : string
Parameters
- $module : string = 'VuFind'
-
Module containing fixture.
Return values
string —getFixturePath()
Resolve fixture path.
protected
getFixturePath(string $filename[, string $module = 'VuFind' ]) : string
Parameters
- $filename : string
-
Filename relative to fixture directory.
- $module : string = 'VuFind'
-
Module containing fixture.
Tags
Return values
string —getJsonFixture()
Load a JSON fixture from file (using associative array return type).
protected
getJsonFixture(string $filename[, string $module = 'VuFind' ]) : array<string|int, mixed>
Parameters
- $filename : string
-
Filename relative to fixture directory.
- $module : string = 'VuFind'
-
Module containing fixture.
Return values
array<string|int, mixed> —getProperty()
Return protected or private property.
protected
getProperty(object|string $object, string $property) : mixed
Uses PHP's reflection API in order to modify property accessibility.
Parameters
- $object : object|string
-
Object or class name
- $property : string
-
Property name
Tags
Return values
mixed —runSpellingTest()
Generic test.
protected
runSpellingTest(int $testNum, array<string|int, mixed> $expected[, array<string|int, mixed> $config = [] ]) : void
Parameters
- $testNum : int
-
Test data number to load
- $expected : array<string|int, mixed>
-
Expected output
- $config : array<string|int, mixed> = []
-
SpellingProcessor configuration
Return values
void —setProperty()
Set protected or private property.
protected
setProperty(object|string $object, string $property, mixed $value) : void
Uses PHP's reflection API in order to modify property accessibility.
Parameters
- $object : object|string
-
Object or class name
- $property : string
-
Property name
- $value : mixed
-
Property value
Tags
Return values
void —unserializeFixture()
Get a fixture object
protected
unserializeFixture(string $file) : mixed
Parameters
- $file : string
-
Name of fixture file