summaryrefslogtreecommitdiffstats
path: root/tests/src/Unit/Plugin
diff options
context:
space:
mode:
authorJoris Vercammen2015-11-29 11:48:53 (GMT)
committerJoris Vercammen2015-11-29 11:48:53 (GMT)
commit1b53358341bb167bafb93c29029b37cbdea91f1e (patch)
treede124ff4a75af44edaf7edac7ef2efe90fc3a253 /tests/src/Unit/Plugin
parentfe920b654970bab8eac9911a9c0b4bd662c757ee (diff)
Extend unit test for LinksWidget to test the newly added show_numbers configuration.
Diffstat (limited to 'tests/src/Unit/Plugin')
-rw-r--r--tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php b/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php
index 90c3f86..8955b7f 100644
--- a/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php
+++ b/tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php
@@ -71,9 +71,9 @@ class CheckboxWidgetTest extends UnitTestCase {
}
/**
- * Test widget
+ * Test widget with default settings.
*/
- public function testNoFilterResults() {
+ public function testDefaultSettings() {
$facet = new Facet([], 'facet');
$facet->setResults($this->original_results);
@@ -88,4 +88,23 @@ class CheckboxWidgetTest extends UnitTestCase {
}
}
+ /**
+ * Test widget with show numbers enabled.
+ */
+ public function testShowAmount() {
+ $facet = new Facet([], 'facet');
+ $facet->setResults($this->original_results);
+ $facet->set('widget_configs', ['show_numbers' => 1]);
+
+ $output = $this->widget->build($facet);
+
+ $this->assertInternalType('array', $output);
+ $this->assertCount(4, $output['#items']);
+
+ $expected_links = ['Llama (10)', 'Badger (20)', 'Duck (15)', 'Alpaca (9)'];
+ foreach ($expected_links as $index => $value) {
+ $this->assertEquals($value, $output['#items'][$index]);
+ }
+ }
+
}