summaryrefslogtreecommitdiffstats
path: root/tests/src/Unit/Plugin
diff options
context:
space:
mode:
authorChristianAdamski2016-01-11 14:31:01 (GMT)
committerJoris Vercammen2016-01-11 14:31:01 (GMT)
commit4653c4577f1e34026f739cc073be22febee6bbd3 (patch)
treee2297f896c92977e1f0b662d8cf0a370c73e1891 /tests/src/Unit/Plugin
parent645ef745db969999956ad374fba3470b6f52ad41 (diff)
Issue #2645128 by ChristianAdamski, borisson_: Clean up facet schema / class
Diffstat (limited to 'tests/src/Unit/Plugin')
-rw-r--r--tests/src/Unit/Plugin/processor/CountLimitProcessorTest.php36
-rw-r--r--tests/src/Unit/Plugin/processor/ExcludeSpecifiedItemsProcessorTest.php24
-rw-r--r--tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php2
-rw-r--r--tests/src/Unit/Plugin/widget/LinksWidgetTest.php10
4 files changed, 50 insertions, 22 deletions
diff --git a/tests/src/Unit/Plugin/processor/CountLimitProcessorTest.php b/tests/src/Unit/Plugin/processor/CountLimitProcessorTest.php
index 12b672b..4db2c91 100644
--- a/tests/src/Unit/Plugin/processor/CountLimitProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/CountLimitProcessorTest.php
@@ -78,10 +78,10 @@ class CountLimitProcessorTest extends UnitTestCase {
public function testNoFilter() {
$facet = new Facet([], 'facet');
$facet->setResults($this->originalResults);
- $facet->setOption('processors', [
- 'count_limit' => [
- 'settings' => ['minimum_items' => 4],
- ],
+ $facet->addProcessor([
+ 'processor_id' => 'count_limit',
+ 'weights' => [],
+ 'settings' => ['minimum_items' => 4],
]);
$this->processor->setConfiguration(['minimum_items' => 4]);
$sorted_results = $this->processor->build($facet, $this->originalResults);
@@ -99,10 +99,10 @@ class CountLimitProcessorTest extends UnitTestCase {
public function testMinEqualsValue() {
$facet = new Facet([], 'facet');
$facet->setResults($this->originalResults);
- $facet->setOption('processors', [
- 'count_limit' => [
- 'settings' => ['minimum_items' => 5],
- ],
+ $facet->addProcessor([
+ 'processor_id' => 'count_limit',
+ 'weights' => [],
+ 'settings' => ['minimum_items' => 5],
]);
$this->processor->setConfiguration(['minimum_items' => 5]);
@@ -121,8 +121,10 @@ class CountLimitProcessorTest extends UnitTestCase {
public function testBetweenMinAndMaxValue() {
$facet = new Facet([], 'facet');
$facet->setResults($this->originalResults);
- $facet->setOption('processors', [
- 'count_limit' => [],
+ $facet->addProcessor([
+ 'processor_id' => 'count_limit',
+ 'weights' => [],
+ 'settings' => [],
]);
$this->processor->setConfiguration(['minimum_items' => 6, 'maximum_items' => 14]);
@@ -145,8 +147,10 @@ class CountLimitProcessorTest extends UnitTestCase {
public function testMaxValue() {
$facet = new Facet([], 'facet');
$facet->setResults($this->originalResults);
- $facet->setOption('processors', [
- 'count_limit' => [],
+ $facet->addProcessor([
+ 'processor_id' => 'count_limit',
+ 'weights' => [],
+ 'settings' => [],
]);
$this->processor->setConfiguration(['maximum_items' => 14]);
@@ -173,10 +177,10 @@ class CountLimitProcessorTest extends UnitTestCase {
public function testFilterResults() {
$facet = new Facet([], 'facet');
$facet->setResults($this->originalResults);
- $facet->setOption('processors', [
- 'count_limit' => [
- 'settings' => ['minimum_items' => 8],
- ],
+ $facet->addProcessor([
+ 'processor_id' => 'count_limit',
+ 'weights' => [],
+ 'settings' => ['minimum_items' => 8],
]);
$this->processor->setConfiguration(['minimum_items' => 8]);
diff --git a/tests/src/Unit/Plugin/processor/ExcludeSpecifiedItemsProcessorTest.php b/tests/src/Unit/Plugin/processor/ExcludeSpecifiedItemsProcessorTest.php
index 5c37429..a6c9762 100644
--- a/tests/src/Unit/Plugin/processor/ExcludeSpecifiedItemsProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/ExcludeSpecifiedItemsProcessorTest.php
@@ -91,6 +91,14 @@ class ExcludeSpecifiedItemsProcessorTest extends UnitTestCase {
],
],
]);
+ $facet->addProcessor([
+ 'processor_id' => 'exclude_specified_items',
+ 'weights' => [],
+ 'settings' => [
+ 'exclude' => 'alpaca',
+ 'regex' => 0,
+ ],
+ ]);
$this->processor->setConfiguration([
'exclude' => 'alpaca',
'regex' => 0,
@@ -114,6 +122,14 @@ class ExcludeSpecifiedItemsProcessorTest extends UnitTestCase {
],
],
]);
+ $facet->addProcessor([
+ 'processor_id' => 'exclude_specified_items',
+ 'weights' => [],
+ 'settings' => [
+ 'exclude' => 'alpaca',
+ 'regex' => 0,
+ ],
+ ]);
$this->processor->setConfiguration([
'exclude' => 'llama',
'regex' => 0,
@@ -143,6 +159,14 @@ class ExcludeSpecifiedItemsProcessorTest extends UnitTestCase {
],
],
]);
+ $facet->addProcessor([
+ 'processor_id' => 'exclude_specified_items',
+ 'weights' => [],
+ 'settings' => [
+ 'exclude' => 'alpaca',
+ 'regex' => 0,
+ ],
+ ]);
$this->processor->setConfiguration([
'exclude' => $regex,
'regex' => 1,
diff --git a/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php b/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php
index 7b3c6c1..f24ee45 100644
--- a/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php
+++ b/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php
@@ -96,7 +96,7 @@ class CheckboxWidgetTest extends UnitTestCase {
public function testShowAmount() {
$facet = new Facet([], 'facet');
$facet->setResults($this->originalResults);
- $facet->set('widget_configs', ['show_numbers' => 1]);
+ $facet->setWidgetConfigs(['show_numbers' => 1]);
$output = $this->widget->build($facet);
diff --git a/tests/src/Unit/Plugin/widget/LinksWidgetTest.php b/tests/src/Unit/Plugin/widget/LinksWidgetTest.php
index 2f26246..6d737ff 100644
--- a/tests/src/Unit/Plugin/widget/LinksWidgetTest.php
+++ b/tests/src/Unit/Plugin/widget/LinksWidgetTest.php
@@ -73,7 +73,7 @@ class LinksWidgetTest extends UnitTestCase {
public function testNoFilterResults() {
$facet = new Facet([], 'facet');
$facet->setResults($this->originalResults);
- $facet->set('widget_configs', ['show_numbers' => 1]);
+ $facet->setWidgetConfigs(['show_numbers' => 1]);
$output = $this->widget->build($facet);
@@ -95,7 +95,7 @@ class LinksWidgetTest extends UnitTestCase {
$facet = new Facet([], 'facet');
$facet->setResults($original_results);
- $facet->set('widget_configs', ['show_numbers' => 1]);
+ $facet->setWidgetConfigs(['show_numbers' => 1]);
$output = $this->widget->build($facet);
@@ -118,7 +118,7 @@ class LinksWidgetTest extends UnitTestCase {
$facet = new Facet([], 'facet');
$facet->setResults($original_results);
- $facet->set('widget_configs', ['show_numbers' => 1]);
+ $facet->setWidgetConfigs(['show_numbers' => 1]);
$output = $this->widget->build($facet);
@@ -145,7 +145,7 @@ class LinksWidgetTest extends UnitTestCase {
$facet = new Facet([], 'facet');
$facet->setResults($original_results);
- $facet->set('widget_configs', ['show_numbers' => 0]);
+ $facet->setWidgetConfigs(['show_numbers' => 0]);
$output = $this->widget->build($facet);
@@ -159,7 +159,7 @@ class LinksWidgetTest extends UnitTestCase {
// Enable the 'show_numbers' setting again to make sure that the switch
// between those settings works.
- $facet->set('widget_configs', ['show_numbers' => 1]);
+ $facet->setWidgetConfigs(['show_numbers' => 1]);
$output = $this->widget->build($facet);