HierarchicalFacetHelperTest
extends TestCase
in package
Unit tests for Hierarchical Facet Helper.
Tags
Table of Contents
- $facetList : array<string|int, mixed>
- Test input data.
- $helper : HierarchicalFacetHelper
- Hierarchical Facet Helper
- $invalidFacetList : array<string|int, mixed>
- Invalid test input data.
- testBuildFacetArray() : void
- Tests for buildFacetArray
- testBuildFacetArrayInvalidValues() : void
- Tests for buildFacetArray with invalid values
- testFlattenFacetHierarchy() : void
- Tests for flattenFacetHierarchy
- testFormatDisplayText() : void
- Tests for formatDisplayText
- testGetFilterStringParts() : void
- Tests for getFilterStringParts
- testHierarchicalExcludeFilters() : void
- Test hierarchical exclude filters
- testHierarchicalFacetFilters() : void
- Test hierarchical facet filters
- testIsDeepestFacetLevel() : void
- Tests for isDeepestFacetLevel
- testSortFacetListAllLevelsBooleanFalse() : void
- Tests for sortFacetList (all levels, specified with boolean)
- testSortFacetListAllLevelsStringConfig() : void
- Tests for sortFacetList (all levels, specified with string)
- testSortFacetListDefault() : void
- Tests for sortFacetList (default/count sort -- at present these should make no changes to the input data and can thus both be tested in a single test method).
- testSortFacetListTopLevelBooleanTrue() : void
- Tests for sortFacetList (top level only, specified with boolean)
- testSortFacetListTopLevelStringConfig() : void
- Tests for sortFacetList (top level only, specified with string)
- getMockOptions() : MockObject
- Create mock options class
- setApplied() : array<string|int, mixed>
- Set 'isApplied' to true in facet item with the given value
- setUp() : void
- Setup.
Properties
$facetList
Test input data.
protected
array<string|int, mixed>
$facetList
= [['value' => '0/Book/', 'displayText' => 'Book', 'count' => 1000, 'operator' => 'OR', 'isApplied' => false], ['value' => '0/AV/', 'displayText' => 'Audiovisual', 'count' => 600, 'operator' => 'OR', 'isApplied' => false], ['value' => '0/Audio/', 'displayText' => 'Sound', 'count' => 400, 'operator' => 'OR', 'isApplied' => false], ['value' => '1/Book/BookPart/', 'displayText' => 'Book Part', 'count' => 300, 'operator' => 'OR', 'isApplied' => false], ['value' => '1/Book/Section/', 'displayText' => 'Book Section', 'count' => 200, 'operator' => 'OR', 'isApplied' => false], ['value' => '1/Audio/Spoken/', 'displayText' => 'Spoken Text', 'count' => 100, 'operator' => 'OR', 'isApplied' => false], ['value' => '1/Audio/Music/', 'displayText' => 'Music', 'count' => 50, 'operator' => 'OR', 'isApplied' => false]]
$helper
Hierarchical Facet Helper
protected
HierarchicalFacetHelper
$helper
$invalidFacetList
Invalid test input data.
protected
array<string|int, mixed>
$invalidFacetList
= [['value' => 'Book', 'displayText' => 'Book', 'count' => 1000, 'operator' => 'OR', 'isApplied' => false], ['value' => 'AV', 'displayText' => 'Audiovisual', 'count' => 600, 'operator' => 'OR', 'isApplied' => false], ['value' => 'Audio', 'displayText' => 'Sound', 'count' => 400, 'operator' => 'OR', 'isApplied' => false]]
Methods
testBuildFacetArray()
Tests for buildFacetArray
public
testBuildFacetArray() : void
Return values
void —testBuildFacetArrayInvalidValues()
Tests for buildFacetArray with invalid values
public
testBuildFacetArrayInvalidValues() : void
Return values
void —testFlattenFacetHierarchy()
Tests for flattenFacetHierarchy
public
testFlattenFacetHierarchy() : void
Return values
void —testFormatDisplayText()
Tests for formatDisplayText
public
testFormatDisplayText() : void
Return values
void —testGetFilterStringParts()
Tests for getFilterStringParts
public
testGetFilterStringParts() : void
Return values
void —testHierarchicalExcludeFilters()
Test hierarchical exclude filters
public
testHierarchicalExcludeFilters() : void
Return values
void —testHierarchicalFacetFilters()
Test hierarchical facet filters
public
testHierarchicalFacetFilters() : void
Return values
void —testIsDeepestFacetLevel()
Tests for isDeepestFacetLevel
public
testIsDeepestFacetLevel() : void
Return values
void —testSortFacetListAllLevelsBooleanFalse()
Tests for sortFacetList (all levels, specified with boolean)
public
testSortFacetListAllLevelsBooleanFalse() : void
Return values
void —testSortFacetListAllLevelsStringConfig()
Tests for sortFacetList (all levels, specified with string)
public
testSortFacetListAllLevelsStringConfig() : void
Return values
void —testSortFacetListDefault()
Tests for sortFacetList (default/count sort -- at present these should make no changes to the input data and can thus both be tested in a single test method).
public
testSortFacetListDefault() : void
Return values
void —testSortFacetListTopLevelBooleanTrue()
Tests for sortFacetList (top level only, specified with boolean)
public
testSortFacetListTopLevelBooleanTrue() : void
Return values
void —testSortFacetListTopLevelStringConfig()
Tests for sortFacetList (top level only, specified with string)
public
testSortFacetListTopLevelStringConfig() : void
Return values
void —getMockOptions()
Create mock options class
protected
getMockOptions() : MockObject
Return values
MockObject —setApplied()
Set 'isApplied' to true in facet item with the given value
protected
setApplied(string $facetValue, array<string|int, mixed> $facetList) : array<string|int, mixed>
Parameters
- $facetValue : string
-
Value to search for
- $facetList : array<string|int, mixed>
-
Facet list
Return values
array<string|int, mixed> —Facet list
setUp()
Setup.
protected
setUp() : void