summaryrefslogtreecommitdiffstats
path: root/tests/src/Unit/Plugin
diff options
context:
space:
mode:
authorJoris Vercammen2015-11-04 14:36:27 (GMT)
committerJoris Vercammen2015-11-04 14:36:27 (GMT)
commitca9242c9f01ee01cd721245d14964529ea9202ef (patch)
treecf9610bebe059b41878febe6be5a1417c4272f51 /tests/src/Unit/Plugin
parente94e71efd732937629c26b7315234ca5f539f67b (diff)
Expand MinimumCountProcessorTest
Diffstat (limited to 'tests/src/Unit/Plugin')
-rw-r--r--tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php46
1 files changed, 45 insertions, 1 deletions
diff --git a/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php b/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php
index 8767fc4..4aed1a3 100644
--- a/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/MinimumCountProcessorTest.php
@@ -47,6 +47,50 @@ class MinimumCountProcessorTest extends UnitTestCase {
}
/**
+ * Test no filtering happens
+ */
+ public function testNoFilter() {
+
+ $facet = new Facet([], 'facet');
+ $facet->setResults($this->original_results);
+ $facet->setProcessorConfigs([
+ 'minimum_count' => [
+ 'settings' => ['minimum_items' => 4]
+ ]
+ ]);
+
+ $sorted_results = $this->processor->build($facet, $this->original_results);
+
+ $this->assertCount(3, $sorted_results);
+
+ $this->assertEquals('llama', $sorted_results[0]->getDisplayValue());
+ $this->assertEquals('badger', $sorted_results[1]->getDisplayValue());
+ $this->assertEquals('duck', $sorted_results[2]->getDisplayValue());
+ }
+
+ /**
+ * Test no filtering happens
+ */
+ public function testMinEqualsValue() {
+
+ $facet = new Facet([], 'facet');
+ $facet->setResults($this->original_results);
+ $facet->setProcessorConfigs([
+ 'minimum_count' => [
+ 'settings' => ['minimum_items' => 5]
+ ]
+ ]);
+
+ $sorted_results = $this->processor->build($facet, $this->original_results);
+
+ $this->assertCount(3, $sorted_results);
+
+ $this->assertEquals('llama', $sorted_results[0]->getDisplayValue());
+ $this->assertEquals('badger', $sorted_results[1]->getDisplayValue());
+ $this->assertEquals('duck', $sorted_results[2]->getDisplayValue());
+ }
+
+ /**
* Test filtering of results
*/
public function testFilterResults() {
@@ -55,7 +99,7 @@ class MinimumCountProcessorTest extends UnitTestCase {
$facet->setResults($this->original_results);
$facet->setProcessorConfigs([
'minimum_count' => [
- 'settings' => ['minimum_items' => 6]
+ 'settings' => ['minimum_items' => 8]
]
]);