public function SliderProcessorTest::testPostQueryBigDataSet in Facets 8
Tests the post query method with a big dataset.
@covers ::postQuery
File
- modules/
facets_range_widget/ tests/ src/ Unit/ Plugin/ processor/ SliderProcessorTest.php, line 73
Class
- SliderProcessorTest
- Unit test for processor.
Namespace
Drupal\Tests\facets_range_widget\Unit\Plugin\processorCode
public function testPostQueryBigDataSet() {
$widgetconfig = [
'min_type' => 'foo',
'step' => 1,
];
$facet = new Facet([], 'facets_facet');
$facet
->setWidget('raw', $widgetconfig);
$this
->configureContainer($widgetconfig);
$original_results[] = new Result($facet, 1, 'Small', 5);
foreach (range(100, 100000, 10) as $k) {
$original_results[] = new Result($facet, $k, 'result ' . $k, 1);
}
$original_results[] = new Result($facet, 150000, 'Big', 5);
$facet
->setResults($original_results);
// Process the data.
$startTime = microtime(TRUE);
$this->processor
->postQuery($facet);
$new_results = $facet
->getResults();
$stopTime = microtime(TRUE);
if ($stopTime - $startTime > 1) {
$this
->fail('Test is too slow');
}
$this
->assertCount(150000, $new_results);
}