You are here

protected function BackendTestBase::regressionTest2783987 in Search API 8

Regression test for facet with "min_count" greater than 1.

See also

https://www.drupal.org/node/2783987

1 call to BackendTestBase::regressionTest2783987()
BackendTestBase::regressionTests in tests/src/Kernel/BackendTestBase.php
Executes regression tests for issues that were already fixed.

File

tests/src/Kernel/BackendTestBase.php, line 762

Class

BackendTestBase
Provides a base class for backend tests.

Namespace

Drupal\Tests\search_api\Kernel

Code

protected function regressionTest2783987() {
  $query = $this
    ->buildSearch('test foo');
  $facets = [];
  $facets['type'] = [
    'field' => 'type',
    'limit' => 0,
    'min_count' => 2,
    'missing' => TRUE,
  ];
  $query
    ->setOption('search_api_facets', $facets);
  $query
    ->range(0, 0);
  $results = $query
    ->execute();
  $expected = [
    [
      'count' => 2,
      'filter' => '"item"',
    ],
  ];
  $facets = $results
    ->getExtraData('search_api_facets', [])['type'];
  $this
    ->assertEquals($expected, $facets, 'Correct facets were returned');
}