MultiIndexListenerTest
extends TestCase
in package
Uses
MockSearchCommandTrait, ReflectionTrait
Unit tests for multiindex listener.
Tags
Table of Contents
- $backend : BackendInterface
- Backend.
- $fields : array<string|int, mixed>
- Shard fields used for stripping tests.
- $listener : MultiIndexListener
- Prepare listener.
- $shards : array<string|int, mixed>
- Available shards used for stripping tests.
- $specs : array<string|int, mixed>
- Specs used for stripping tests.
- testAllShardsUsedForRecordRetrieval() : void
- Test that loading a record overrides the shard settings.
- testAttach() : void
- Test attaching listener.
- testStripFacetFields() : void
- Strip fields from a field facet.
- testStripSpecsAllQueryFields() : void
- Strip an entire QueryFields section.
- testStripSpecsEmptySpecs() : void
- Apply strip to empty specs.
- testStripSpecsNoFieldsToStrip() : void
- Don't strip anything.
- testStripSpecsStrip() : void
- Strip specs.
- callMethod() : mixed
- Call protected or private method for side-effect and result.
- getMockSearchCommand() : AbstractBase
- Get a mock search command.
- getProperty() : mixed
- Return protected or private property.
- setProperty() : void
- Set protected or private property.
- setUp() : void
- Setup.
Properties
$backend
Backend.
protected
BackendInterface
$backend
$fields
Shard fields used for stripping tests.
protected
static array<string|int, mixed>
$fields
= ['a' => ['field_1', 'field_3'], 'b' => ['field_3']]
$listener
Prepare listener.
protected
MultiIndexListener
$listener
$shards
Available shards used for stripping tests.
protected
static array<string|int, mixed>
$shards
= ['a' => 'example.org/a', 'b' => 'example.org/b', 'c' => 'example.org/c']
$specs
Specs used for stripping tests.
protected
static array<string|int, mixed>
$specs
= ['test' => ['QueryFields' => ['A' => [['onephrase', 500], ['and', 200]], 'B' => [['and', 100], ['or', 50]], 0 => [0 => ['AND', 50], 'C' => [['onephrase', 200]], 'D' => [['onephrase', 300]], '-E' => [['or', '~']]]], 'FilterQuery' => 'format:Book']]
Methods
testAllShardsUsedForRecordRetrieval()
Test that loading a record overrides the shard settings.
public
testAllShardsUsedForRecordRetrieval() : void
Return values
void —testAttach()
Test attaching listener.
public
testAttach() : void
Return values
void —testStripFacetFields()
Strip fields from a field facet.
public
testStripFacetFields() : void
Return values
void —testStripSpecsAllQueryFields()
Strip an entire QueryFields section.
public
testStripSpecsAllQueryFields() : void
Return values
void —testStripSpecsEmptySpecs()
Apply strip to empty specs.
public
testStripSpecsEmptySpecs() : void
Return values
void —testStripSpecsNoFieldsToStrip()
Don't strip anything.
public
testStripSpecsNoFieldsToStrip() : void
Return values
void —testStripSpecsStrip()
Strip specs.
public
testStripSpecsStrip() : 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 —getMockSearchCommand()
Get a mock search command.
protected
getMockSearchCommand([ParamBag $params = null ][, mixed $context = null ][, string $backendId = 'foo' ][, mixed $result = null ]) : AbstractBase
Parameters
- $params : ParamBag = null
-
Parameters for command to return
- $context : mixed = null
-
Context for command to return
- $backendId : string = 'foo'
-
Backend ID for command
- $result : mixed = null
-
Result to return
Return values
AbstractBase —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 —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 —setUp()
Setup.
protected
setUp() : void