You are here

function SearchTokenizerTest::testNoTokenizer in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/search/src/Tests/SearchTokenizerTest.php \Drupal\search\Tests\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/src/Tests/SearchTokenizerTest.php, line 114
Contains \Drupal\search\Tests\SearchTokenizerTest.

Class

SearchTokenizerTest
Tests that CJK tokenizer works as intended.

Namespace

Drupal\search\Tests

Code

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();
  $this
    ->refreshVariables();
  $letters = 'abcdefghijklmnopqrstuvwxyz';
  $out = trim(search_simplify($letters));
  $this
    ->assertEqual($letters, $out, 'Letters are not CJK tokenized');
}