You are here

protected function SearchApiSolrTest::regressionTest2469547 in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::regressionTest2469547()
  2. 8 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::regressionTest2469547()
  3. 4.x tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::regressionTest2469547()

Regression tests for #2469547.

Overrides BackendTestBase::regressionTest2469547

File

tests/src/Kernel/SearchApiSolrTest.php, line 81

Class

SearchApiSolrTest
Tests index and search capabilities using the Solr search backend.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function regressionTest2469547() {
  $query = $this
    ->buildSearch();
  $facets = [];
  $facets['body'] = [
    'field' => 'body',
    'limit' => 0,
    'min_count' => 1,
    'missing' => FALSE,
  ];
  $query
    ->setOption('search_api_facets', $facets);
  $query
    ->addCondition('id', 5, '<>');
  $query
    ->range(0, 0);
  $results = $query
    ->execute();
  $expected = $this
    ->getExpectedFacetsOfRegressionTest2469547();

  // We can't guarantee the order of returned facets, since "bar" and "foobar"
  // both occur once, so we have to manually sort the returned facets first.
  $facets = $results
    ->getExtraData('search_api_facets', [])['body'];
  usort($facets, [
    $this,
    'facetCompare',
  ]);
  $this
    ->assertEquals($expected, $facets, 'Correct facets were returned for a fulltext field.');
}