public function CoreSearchTest::testSearchStemming in Snowball Stemmer 8
Same name and namespace in other branches
- 2.x tests/src/Kernel/CoreSearchTest.php \Drupal\Tests\snowball_stemmer\Kernel\CoreSearchTest::testSearchStemming()
Tests the hook stemming alone.
File
- tests/
src/ Kernel/ CoreSearchTest.php, line 60
Class
- CoreSearchTest
- Tests the search_excerpt() function.
Namespace
Drupal\Tests\snowball_stemmer\KernelCode
public function testSearchStemming() {
// HTML is stripped by Search module, but non-alpha-numeric characters are
// maintained for later tokenizing. Search simplify has lowercased the
// string.
$text = 'van de groep 65-plussers is dat 14%.';
$language = 'nl';
$expected = 'van de groep 65-plusser is dat 14%.';
$this->stemmerService
->expects($this
->once())
->method('setLanguage')
->with('nl')
->willReturn(TRUE);
$this->stemmerService
->expects($this
->exactly(8))
->method('stem')
->withConsecutive([
'van',
], [
'de',
], [
'groep',
], [
'65',
], [
'plussers',
], [
'is',
], [
'dat',
], [
'14',
])
->will($this
->onConsecutiveCalls('van', 'de', 'groep', '65', 'plusser', 'is', 'dat', '14'));
$out = snowball_stemmer_search_preprocess($text, $language);
$this
->assertEqual($out, $expected);
}