public function StemmerTest::testPreprocessWordsString in Snowball Stemmer 8
Same name and namespace in other branches
- 2.x tests/src/Unit/Plugin/Processor/StemmerTest.php \Drupal\Tests\snowball_stemmer\Unit\Plugin\Processor\StemmerTest::testPreprocessWordsString()
Tests string explode of preprocessIndexItems() method.
@covers ::preprocessIndexItems
File
- tests/
src/ Unit/ Plugin/ Processor/ StemmerTest.php, line 91
Class
- StemmerTest
- Tests the "Stemmer" processor.
Namespace
Drupal\Tests\snowball_stemmer\Unit\Plugin\ProcessorCode
public function testPreprocessWordsString() {
$index = $this
->createMock(IndexInterface::class);
$this->stemmerService
->expects($this
->once())
->method('setLanguage')
->with('nl')
->willReturn(TRUE);
$this->stemmerService
->expects($this
->exactly(3))
->method('stem')
->will($this
->returnValueMap([
[
'twee',
'twee',
],
[
'korte',
'kort',
],
[
'zinnen',
'zin',
],
]));
$item = $this
->getMockBuilder(ItemInterface::class)
->disableOriginalConstructor()
->getMock();
$item
->method('getLanguage')
->willReturn('nl');
$field = new Field($index, 'foo');
$field
->setType('text');
$field
->setValues([
new TextValue('Twee korte zinnen.'),
]);
$item
->method('getFields')
->willReturn([
'foo' => $field,
]);
$this->processor
->preprocessIndexItems([
$item,
]);
}