Commit 1b533583 authored by borisson_'s avatar borisson_

Extend unit test for LinksWidget to test the newly added show_numbers configuration.

parent fe920b65
...@@ -71,9 +71,9 @@ class CheckboxWidgetTest extends UnitTestCase { ...@@ -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 = new Facet([], 'facet');
$facet->setResults($this->original_results); $facet->setResults($this->original_results);
...@@ -88,4 +88,23 @@ class CheckboxWidgetTest extends UnitTestCase { ...@@ -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]);
}
}
} }
Markdown is supported
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