diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SideFacetsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SideFacetsTest.php index c40e28b34f9c545049e7ccdc7056d25c658747d6..f09cc132e62a9723e44c719fc8a21ed8e21314e7 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SideFacetsTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/SideFacetsTest.php @@ -159,6 +159,58 @@ class SideFacetsTest extends \VuFindTest\Unit\TestCase $this->assertEquals($expected, $sf->getAllRangeFacets()); } + /** + * Test default getCollapsedFacets behavior. + * + * @return void + */ + public function testGetCollapsedFacetsDefault() + { + $this->assertEquals(array(), $this->getSideFacets()->getCollapsedFacets()); + } + + /** + * Test asterisk support in getCollapsedFacets + * + * @return void + */ + public function testGetCollapsedFacetsDelimitedList() + { + $config = array( + 'Results_Settings' => array('collapsedFacets' => ' foo, bar,baz '), + ); + $sf = $this->getSideFacets($this->getMockConfigLoader($config)); + $this->assertEquals(array('foo', 'bar', 'baz'), $sf->getCollapsedFacets()); + } + + /** + * Test delimited list support in getCollapsedFacets + * + * @return void + */ + public function testGetCollapsedFacetsWildcard() + { + $config = array( + 'Results' => array( + 'format' => 'Format', + ), + 'Results_Settings' => array('collapsedFacets' => '*'), + ); + $filters = array( + 'format' => array( + array('value' => 'foo'), + array('value' => 'bar', 'suppressDisplay' => true), + ), + ); + $results = $this->getMockResults(); + $response = array('format' => array('dummy')); + $results->expects($this->once())->method('getFacetList') + ->with($this->equalTo(array('format' => 'Format'))) + ->will($this->returnValue($response)); + $sf = $this->getSideFacets($this->getMockConfigLoader($config), $results); + $this->assertEquals(array('format'), $sf->getCollapsedFacets()); + } + /** * Get a fully configured module *