public function TermsParseModeTest::parseInputTestDataProvider in Search API 8
Provides test data for testParseInput().
Return value
array[] An array of argument arrays for testParseInput().
See also
\Drupal\Tests\search_api\Unit\TermsParseModeTest::testParseInput()
File
- tests/
src/ Unit/ TermsParseModeTest.php, line 56
Class
- TermsParseModeTest
- Tests functionality of the "Multiple words" parse mode.
Namespace
Drupal\Tests\search_api\UnitCode
public function parseInputTestDataProvider() {
return [
'normal keywords' => [
'keys' => 'foo bar',
'expected' => [
'#conjunction' => 'AND',
'foo',
'bar',
],
],
'quoted phrase' => [
'keys' => '"cogito ergo sum"',
'expected' => [
'#conjunction' => 'AND',
'cogito ergo sum',
],
],
'single-word quotes' => [
'keys' => '"foo"',
'expected' => [
'#conjunction' => 'AND',
'foo',
],
],
'negated keyword' => [
'keys' => '-foo',
'expected' => [
'#conjunction' => 'AND',
[
'#negation' => TRUE,
'#conjunction' => 'AND',
'foo',
],
],
],
'negated phrase' => [
'keys' => '-"cogito ergo sum"',
'expected' => [
'#conjunction' => 'AND',
[
'#conjunction' => 'AND',
'#negation' => TRUE,
'cogito ergo sum',
],
],
],
'keywords with stand-alone dash' => [
'keys' => 'foo - bar',
'expected' => [
'#conjunction' => 'AND',
'foo',
'bar',
],
],
'really complicated search' => [
'keys' => 'pos -neg "quoted pos with -minus" - -"quoted neg"',
'expected' => [
'#conjunction' => 'AND',
'pos',
[
'#negation' => TRUE,
'#conjunction' => 'AND',
'neg',
],
'quoted pos with -minus',
[
'#negation' => TRUE,
'#conjunction' => 'AND',
'quoted neg',
],
],
],
'multi-byte space' => [
'keys' => '神奈川県 連携',
'expected' => [
'#conjunction' => 'AND',
'神奈川県',
'連携',
],
],
];
}