Skip to content

Commit 344e260

Browse files
committed
Add test for excluding hierarchical facets.
1 parent 9882b7e commit 344e260

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchFacetsTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,54 @@ public function testHierarchicalFacets()
350350
$this->clickHierarchyFacet($page);
351351
}
352352

353+
/**
354+
* Test that hierarchy facet exclusion works properly.
355+
*
356+
* @return void
357+
*/
358+
public function testHierarchicalFacetExclude()
359+
{
360+
$this->changeConfigs(
361+
[
362+
'facets' => [
363+
'Results' => [
364+
'hierarchical_facet_str_mv' => 'hierarchy'
365+
],
366+
'SpecialFacets' => [
367+
'hierarchical[]' => 'hierarchical_facet_str_mv'
368+
],
369+
'Results_Settings' => [
370+
'exclude' => 'hierarchical_facet_str_mv',
371+
]
372+
]
373+
]
374+
);
375+
$extractCount = function ($str) {
376+
$parts = explode(',', $str);
377+
return $parts[0];
378+
};
379+
$page = $this->performSearch('building:"hierarchy.mrc"');
380+
$stats = $this->findCss($page, '.search-stats');
381+
$this->assertEquals(
382+
'Showing 1 - 10 results of 10 for search \'building:"hierarchy.mrc"\'',
383+
$extractCount($stats->getText())
384+
);
385+
$this->clickCss($page, '#j1_1.jstree-closed .jstree-icon');
386+
$this->snooze();
387+
$this->findCss($page, '#j1_1.jstree-open .jstree-icon');
388+
$this->clickCss($page, '#j1_2 a.exclude');
389+
$this->snooze();
390+
$filter = $this->findCss($page, $this->activeFilterSelector);
391+
$label = $this->findCss($page, '.filters .filters-title');
392+
$this->assertEquals('hierarchy:', $label->getText());
393+
$this->assertEquals('level1a/level2a', $filter->getText());
394+
$stats = $this->findCss($page, '.search-stats');
395+
$this->assertEquals(
396+
'Showing 1 - 7 results of 7 for search \'building:"hierarchy.mrc"\'',
397+
$extractCount($stats->getText())
398+
);
399+
}
400+
353401
/**
354402
* Test that we can persist uncollapsed state of collapsed facets
355403
*

0 commit comments

Comments
 (0)