public function TokenizerTest::testPreprocessSearchQuery in Search API 8
Tests search keywords preprocessing.
@dataProvider preprocessSearchQueryProvider
Parameters
string|array $keys: The original keys.
string|array $expected: The expected keys after preprocessing.
File
- tests/
src/ Unit/ Processor/ TokenizerTest.php, line 424
Class
- TokenizerTest
- Tests the "Tokenizer" processor.
Namespace
Drupal\Tests\search_api\Unit\ProcessorCode
public function testPreprocessSearchQuery($keys, $expected) {
$index = $this
->createMock(Index::class);
assert($index instanceof Index);
assert($index instanceof MockObject);
$index
->method('status')
->willReturn(TRUE);
$this->processor
->setIndex($index);
$query = new Query($index);
$query
->setParseMode(new Direct([], 'direct', []));
$query
->keys($keys);
$this->processor
->preprocessSearchQuery($query);
$this
->assertEquals($expected, $query
->getKeys());
}