public function SliderProcessorTest::testPostQueryResultSorting in Facets 8
Tests the post query method result sorting.
@covers ::postQuery
File
- modules/
facets_range_widget/ tests/ src/ Unit/ Plugin/ processor/ SliderProcessorTest.php, line 103
Class
- SliderProcessorTest
- Unit test for processor.
Namespace
Drupal\Tests\facets_range_widget\Unit\Plugin\processorCode
public function testPostQueryResultSorting() {
$widgetconfig = [
'min_type' => 'foo',
'step' => 1,
];
$facet = new Facet([], 'facets_facet');
$facet
->setWidget('raw', $widgetconfig);
$this
->configureContainer($widgetconfig);
$original_results = [];
foreach ([
10,
100,
200,
5,
] as $k) {
$original_results[] = new Result($facet, $k, 'result ' . $k, 1);
}
$facet
->setResults($original_results);
// Process the data.
$this->processor
->postQuery($facet);
$new_results = $facet
->getResults();
$this
->assertCount(196, $new_results);
$this
->assertEquals(5, $new_results[0]
->getRawValue());
$this
->assertEquals(200, $new_results[195]
->getRawValue());
}