VuFind API Documentation

HierarchicalFacetHelperTest extends TestCase
in package

Unit tests for Hierarchical Facet Helper.

Tags
category

VuFind

author

Ere Maijala ere.maijala@helsinki.fi

author

Juha Luoma juha.luoma@helsinki.fi

license

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

link

Main Site

todo

Test buildFacetArray using url helper

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]]

$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

testBuildFacetArrayInvalidValues()

Tests for buildFacetArray with invalid values

public testBuildFacetArrayInvalidValues() : void
Return values
void

testFlattenFacetHierarchy()

Tests for flattenFacetHierarchy

public testFlattenFacetHierarchy() : 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

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

Search results