You are here

public function StemmerTest::testOverrides in Snowball Stemmer 8

Same name in this branch
  1. 8 tests/src/Unit/StemmerTest.php \Drupal\Tests\snowball_stemmer\Unit\StemmerTest::testOverrides()
  2. 8 tests/src/Unit/Plugin/Processor/StemmerTest.php \Drupal\Tests\snowball_stemmer\Unit\Plugin\Processor\StemmerTest::testOverrides()
Same name and namespace in other branches
  1. 2.x tests/src/Unit/StemmerTest.php \Drupal\Tests\snowball_stemmer\Unit\StemmerTest::testOverrides()

Test overrides.

@covers ::setOverrides @covers ::hasOverride

File

tests/src/Unit/StemmerTest.php, line 79

Class

StemmerTest
Test Snowball Stemmer class wrapping.

Namespace

Drupal\Tests\snowball_stemmer\Unit

Code

public function testOverrides() {
  $this->stemmer
    ->setLanguage('en');
  $this->stemmer
    ->setOverrides([
    'our' => 'special',
    'term' => 'kept',
  ]);
  $this->stemmer
    ->setOverrides([
    'term' => 'english',
    'also' => 'overriden',
  ], 'en');
  $this
    ->assertEquals($this->stemmer
    ->stem('our'), 'special');
  $this
    ->assertEquals($this->stemmer
    ->stem('term'), 'english');
  $this
    ->assertEquals($this->stemmer
    ->stem('also'), 'overriden');
}