You are here

protected function BackendTestBase::regressionTest2745655 in Search API 8

Tests (NOT) NULL conditions on fulltext fields.

See also

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

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

File

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

Class

BackendTestBase
Provides a base class for backend tests.

Namespace

Drupal\Tests\search_api\Kernel

Code

protected function regressionTest2745655() {
  $name = $this->entities[3]->name[0]->value;
  $this->entities[3]->name[0]->value = NULL;
  $this->entities[3]
    ->save();
  $this
    ->indexItems($this->indexId);
  $results = $this
    ->buildSearch()
    ->addCondition('name', NULL)
    ->execute();
  $this
    ->assertResults([
    3,
  ], $results, 'Search for items without name');
  $results = $this
    ->buildSearch()
    ->addCondition('name', NULL, '<>')
    ->execute();
  $this
    ->assertResults([
    1,
    2,
    4,
    5,
  ], $results, 'Search for items with name');
  $this->entities[3]
    ->set('name', [
    $name,
  ]);
  $this->entities[3]
    ->save();
  $this
    ->indexItems($this->indexId);
}