3 namespace Drupal\Tests\porterstemmer\Unit;
6 * Tests the "PorterStemmer" implementation with PECL stem_english().
10 * @see https://pecl.php.net/package/stem
12 class Porter2Pecl5 extends PorterPeclBase {
15 * Test PECL stem_english() with a data provider method.
17 * Uses the data provider method to test with a wide range of words/stems.
19 * @dataProvider stemDataProvider
21 public function testStem($word, $stem) {
22 if ($this->has_pecl_stem) {
23 $this->assertEquals($stem, stem_english($word));
26 $this->assertTrue(TRUE, 'No PECL stem library found, Aborting test.');
31 * Data provider for testStem().
34 * Nested arrays of values to check:
38 public function stemDataProvider() {
39 if ($this->has_pecl_stem) {
40 return $this->retrieveStemWords(20000);
43 return array(array('', ''));