You are here

public function SearchTokenizerTest::testNoTokenizer in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/search/tests/src/Kernel/SearchTokenizerTest.php \Drupal\Tests\search\Kernel\SearchTokenizerTest::testNoTokenizer()
  2. 10 core/modules/search/tests/src/Kernel/SearchTokenizerTest.php \Drupal\Tests\search\Kernel\SearchTokenizerTest::testNoTokenizer()

Verifies that strings of non-CJK characters are not tokenized.

This is just a sanity check - it verifies that strings of letters are not tokenized.

File

core/modules/search/tests/src/Kernel/SearchTokenizerTest.php, line 114

Class

SearchTokenizerTest
Tests that CJK tokenizer works as intended.

Namespace

Drupal\Tests\search\Kernel

Code

public function testNoTokenizer() {

  // Set the minimum word size to 1 (to split all CJK characters) and make
  // sure CJK tokenizing is turned on.
  $this
    ->config('search.settings')
    ->set('index.minimum_word_size', 1)
    ->set('index.overlap_cjk', TRUE)
    ->save();
  $letters = 'abcdefghijklmnopqrstuvwxyz';
  $out = trim(search_simplify($letters));
  $this
    ->assertEqual($letters, $out, 'Letters are not CJK tokenized');
}