The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit e84e122a authored by Demian Katz's avatar Demian Katz
Browse files

Recycle parent constructor; more test coverage.

parent 7bc6f528
No related merge requests found
......@@ -123,7 +123,7 @@ class SideFacets extends AbstractFacets
\VuFind\Config\PluginManager $configLoader,
HierarchicalFacetHelper $facetHelper = null
) {
$this->configLoader = $configLoader;
parent::__construct($configLoader);
$this->hierarchicalFacetHelper = $facetHelper;
}
......
......@@ -99,6 +99,77 @@ class SideFacetsTest extends \VuFindTest\Unit\TestCase
$sf->getFacetSet();
}
/**
* Test facet initialization.
*
* @return void
*/
public function testFacetInit()
{
$configLoader = $this->getMockConfigLoader(
array(
'Results' => array(
'format' => 'Format',
),
'Results_Settings' => array(
'orFacets' => '*', // test or facet support
),
'Checkboxes' => array(
'description' => 'filter',
)
)
);
$results = $this->getMockResults();
$params = $results->getParams();
$params->expects($this->once())->method('addFacet')->with($this->equalTo('format'), $this->equalTo('Format'), $this->equalTo(true));
$params->expects($this->once())->method('addCheckboxFacet')->with($this->equalTo('filter'), $this->equalTo('description'));
$this->getSideFacets($configLoader, $results, ':~Checkboxes'); // test ~ checkbox flip function
}
/**
* Test getFacetOperator
*
* @return void
*/
public function testGetFacetOperator()
{
$this->assertEquals('AND', $this->getSideFacets()->getFacetOperator('format')); // default
$configLoader = $this->getMockConfigLoader(
array(
'Results' => array(
'format' => 'Format',
),
'Results_Settings' => array(
'orFacets' => '*', // test or facet support
),
)
);
$sf = $this->getSideFacets($configLoader);
$this->assertEquals('OR', $sf->getFacetOperator('format'));
}
/**
* Test excludeAllowed
*
* @return void
*/
public function testExcludeAllowed()
{
$this->assertFalse($this->getSideFacets()->excludeAllowed('format')); // default
$configLoader = $this->getMockConfigLoader(
array(
'Results' => array(
'format' => 'Format',
),
'Results_Settings' => array(
'exclude' => '*', // test or facet support
),
)
);
$sf = $this->getSideFacets($configLoader);
$this->assertTrue($sf->excludeAllowed('format'));
}
/**
* Test getVisibleFilters
*
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment