You are here

public function AutocompleteHelperTest::providerTestSplitKeys in Search API Autocomplete 8

Data provider for testSplitKeys().

File

tests/src/Unit/AutocompleteHelperTest.php, line 39

Class

AutocompleteHelperTest
Tests various utility methods of the Search API Autocomplete module.

Namespace

Drupal\Tests\search_api_autocomplete\Unit

Code

public function providerTestSplitKeys() {
  $data = [];
  $data['simple word'] = [
    'word',
    [
      '',
      'word',
    ],
  ];
  $data['simple word with dash'] = [
    'word-dash',
    [
      '',
      'word-dash',
    ],
  ];
  $data['trailing whitespace'] = [
    'word-dash ',
    [
      'word-dash',
      '',
    ],
  ];
  $data['quoted first word'] = [
    '"word" other',
    [
      '"word"',
      'other',
    ],
  ];
  $data['quoted word in middle'] = [
    'word "other" word',
    [
      'word "other"',
      'word',
    ],
  ];
  $data['quoted last word'] = [
    'word "other"',
    [
      'word "other"',
      '',
    ],
  ];
  return $data;
}