You are here

protected function BackendTestBase::regressionTest2007872 in Search API 8

Regression tests for missing results when using OR filters.

See also

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

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

File

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

Class

BackendTestBase
Provides a base class for backend tests.

Namespace

Drupal\Tests\search_api\Kernel

Code

protected function regressionTest2007872() {
  $results = $this
    ->buildSearch('test', [], [], FALSE)
    ->sort('id')
    ->sort('type')
    ->execute();
  $this
    ->assertResults([
    1,
    2,
    3,
    4,
  ], $results, 'Sorting on field with NULLs');
  $query = $this
    ->buildSearch(NULL, [], [], FALSE);
  $conditions = $query
    ->createConditionGroup('OR');
  $conditions
    ->addCondition('id', 3);
  $conditions
    ->addCondition('type', 'article');
  $query
    ->addConditionGroup($conditions);
  $query
    ->sort('search_api_id', QueryInterface::SORT_DESC);
  $results = $query
    ->execute();
  $this
    ->assertResults([
    5,
    4,
    3,
  ], $results, 'OR filter on field with NULLs');
}