You are here

public function StemmerTest::testIsNullConditions in Search API 8

Tests whether "IS NULL" conditions are correctly kept.

See also

https://www.drupal.org/project/search_api/issues/3212925

File

tests/src/Unit/Processor/StemmerTest.php, line 291

Class

StemmerTest
Tests the "Stemmer" processor.

Namespace

Drupal\Tests\search_api\Unit\Processor

Code

public function testIsNullConditions() {
  $index = $this
    ->createMock(IndexInterface::class);
  $index
    ->method('getFields')
    ->willReturn([
    'field' => (new Field($index, 'field'))
      ->setType('string'),
  ]);
  $this->processor
    ->setIndex($index);
  $passed_value = NULL;
  $this
    ->invokeMethod('processConditionValue', [
    &$passed_value,
  ]);
  $this
    ->assertSame(NULL, $passed_value);
  $condition = new Condition('field', NULL);
  $conditions = [
    $condition,
  ];
  $this
    ->invokeMethod('processConditions', [
    &$conditions,
  ]);
  $this
    ->assertSame([
    $condition,
  ], $conditions);
}