ConditionalFilterListenerTest
extends TestCase
in package
Uses
MockSearchCommandTrait
Unit tests for Conditional Filter listener.
Tags
Table of Contents
- $backend : BackendInterface
- Backend.
- $emptySearchConfig : array<string|int, mixed>
- Sample configuration for empty ConditionalFilters config.
- $searchConfig : array<string|int, mixed>
- Sample configuration for ConditionalFilters.
- testAttach() : void
- Test attaching listener.
- testConditionalFilter() : void
- Test the listener without preset fq parameters if the conditional filter is granted
- testConditionalFilterEmptyConfig() : void
- Test the listener with an empty conditional filter config.
- testConditionalFilterEmptyConfigWithFQ() : void
- Test the listener with an empty conditional filter config, but with given fq parameters
- testConditionalFilterWithFQ() : void
- Test the listener with preset fq-parameters if the conditional filter is granted
- testConditionalFilterWithoutAuthorizationService() : void
- Test the listener without setting an authorization service.
- testConditionalFilterWithoutAuthorizationServiceWithParams() : void
- Test the listener without setting an authorization service, but with fq-parameters.
- testNegativeConditionalFilter() : void
- Test the listener without preset fq parameters if the conditional filter is not granted
- testNegativeConditionalFilterWithFQ() : void
- Test the listener with preset fq-parameters if the conditional filter is not granted
- getMockPreEvent() : Event
- Construct a mock search backend pre event.
- getMockSearchCommand() : AbstractBase
- Get a mock search command.
- setUp() : void
- Setup.
Properties
$backend
Backend.
protected
BackendInterface
$backend
$emptySearchConfig
Sample configuration for empty ConditionalFilters config.
protected
static array<string|int, mixed>
$emptySearchConfig
= []
$searchConfig
Sample configuration for ConditionalFilters.
protected
static array<string|int, mixed>
$searchConfig
= ['0' => '-conditionalFilter.sample|(NOT institution:"MyInst")', '1' => 'conditionalFilter.sample|institution:"MyInst"']
Methods
testAttach()
Test attaching listener.
public
testAttach() : void
Return values
void —testConditionalFilter()
Test the listener without preset fq parameters if the conditional filter is granted
public
testConditionalFilter() : void
Return values
void —testConditionalFilterEmptyConfig()
Test the listener with an empty conditional filter config.
public
testConditionalFilterEmptyConfig() : void
Return values
void —testConditionalFilterEmptyConfigWithFQ()
Test the listener with an empty conditional filter config, but with given fq parameters
public
testConditionalFilterEmptyConfigWithFQ() : void
Return values
void —testConditionalFilterWithFQ()
Test the listener with preset fq-parameters if the conditional filter is granted
public
testConditionalFilterWithFQ() : void
Return values
void —testConditionalFilterWithoutAuthorizationService()
Test the listener without setting an authorization service.
public
testConditionalFilterWithoutAuthorizationService() : void
This should return an empty array.
Return values
void —testConditionalFilterWithoutAuthorizationServiceWithParams()
Test the listener without setting an authorization service, but with fq-parameters.
public
testConditionalFilterWithoutAuthorizationServiceWithParams() : void
This should not touch the parameters.
Return values
void —testNegativeConditionalFilter()
Test the listener without preset fq parameters if the conditional filter is not granted
public
testNegativeConditionalFilter() : void
Return values
void —testNegativeConditionalFilterWithFQ()
Test the listener with preset fq-parameters if the conditional filter is not granted
public
testNegativeConditionalFilterWithFQ() : void
Return values
void —getMockPreEvent()
Construct a mock search backend pre event.
protected
getMockPreEvent(ParamBag $params[, string $backendId = 'Solr' ]) : Event
Parameters
- $params : ParamBag
-
Search backend parameters
- $backendId : string = 'Solr'
-
Backend identifier
Return values
Event —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 —setUp()
Setup.
protected
setUp() : void