1. 8.5.x core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
  2. 8.0.x core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
  3. 8.1.x core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
  4. 8.2.x core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
  5. 8.3.x core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
  6. 8.4.x core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
  7. 8.6.x core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module

Test module setting up two tests, one for checking if the entity $langcode is being passed on and another one sets up the alternate verb forms for the stemming test.

File

core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
View source
<?php

/**
 * @file
 * Test module setting up two tests, one for checking if the entity $langcode is
 * being passed on and another one sets up the alternate verb forms for the
 * stemming test.
 */

/**
 * Implements hook_search_preprocess().
 */
function search_langcode_test_search_preprocess($text, $langcode = NULL) {
  if (isset($langcode) && $langcode == 'en') {

    // Add the alternate verb forms for the word "testing".
    if ($text == 'we are testing') {
      $text .= ' test tested';
    }
    else {
      drupal_set_message('Langcode Preprocess Test: ' . $langcode);
      $text .= 'Additional text';
    }
  }
  elseif (isset($langcode)) {
    drupal_set_message('Langcode Preprocess Test: ' . $langcode);

    // Preprocessing for the excerpt test.
    if ($langcode == 'ex') {
      $text = str_replace('finding', 'find', $text);
      $text = str_replace('finds', 'find', $text);
      $text = str_replace('dic', ' dependency injection container', $text);
      $text = str_replace('hypertext markup language', 'html', $text);
    }
  }
  return $text;
}

Functions