You are here

public function CoreSearchTest::testSearchSimplify in Snowball Stemmer 2.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/CoreSearchTest.php \Drupal\Tests\snowball_stemmer\Kernel\CoreSearchTest::testSearchSimplify()

Tests search_simplify() and the stemmer hook_search_preprocess integration.

File

tests/src/Kernel/CoreSearchTest.php, line 40

Class

CoreSearchTest
Tests the search_excerpt() function.

Namespace

Drupal\Tests\snowball_stemmer\Kernel

Code

public function testSearchSimplify() {
  $this->stemmerService
    ->expects($this
    ->once())
    ->method('setLanguage')
    ->with('en')
    ->willReturn(TRUE);
  $this->stemmerService
    ->expects($this
    ->exactly(4))
    ->method('stem')
    ->withConsecutive([
    'the',
  ], [
    'quick',
  ], [
    'brown',
  ], [
    'fox',
  ]);
  $text = 'The quick brown fox';
  $language = 'en';
  search_simplify($text, $language);
}