You are here

public function SliderProcessorTest::testPostQueryFixedMinMax in Facets 8

Tests the post query method with fixed min/max.

@covers ::postQuery

File

modules/facets_range_widget/tests/src/Unit/Plugin/processor/SliderProcessorTest.php, line 152

Class

SliderProcessorTest
Unit test for processor.

Namespace

Drupal\Tests\facets_range_widget\Unit\Plugin\processor

Code

public function testPostQueryFixedMinMax() {
  $widgetconfig = [
    'min_type' => 'fixed',
    'min_value' => 10,
    'max_value' => 20,
    'step' => 1,
  ];
  $facet = new Facet([], 'facets_facet');
  $facet
    ->setWidget('raw', $widgetconfig);
  $this
    ->configureContainer($widgetconfig);
  $result_lower = new Result($facet, 5, '5', 1);
  $result_higher = new Result($facet, 150, '150', 1);
  $facet
    ->setResults([
    $result_lower,
    $result_higher,
  ]);

  // Process the data.
  $this->processor
    ->postQuery($facet);
  $new_results = $facet
    ->getResults();
  $this
    ->assertCount(11, $new_results);
}