/** * @dataProvider hyphenationOfSingleWordWithArrayOutputProvider */ public function testHyphenationOfSingleWordWithArrayOutput($word, $language, $expected) { $o = new h\Options(); $o->setHyphen('-')->setDefaultLocale($language)->setRightMin(2)->setLeftMin(2)->setWordMin(5)->setFilters('NonStandard')->setTokenizers('Whitespace', 'Punctuation'); $h = new h\Hyphenator(); $h->setOptions($o); $this->assertEquals($expected, $h->hyphenate($word)); }
/** * @dataProvider filterProvider */ public function testFilter($input, $pattern, $result) { $f = new NonStandardFilter(); $o = new Options(); $t = new t\WordToken($input); $t->addPattern($pattern); $r = new t\TokenRegistry(); $r->add($t); $o->setHyphen('-'); $f->setOptions($o); $this->assertSame($r, $f->run($r)); $this->assertEquals($result, $r->getTokenWithKey(0)->getHyphenatedContent()); }
public function testDefaultLocale() { $o = new Options(); $this->assertEquals('en_EN', $o->getDefaultLocale()); $this->assertSame($o, $o->setDefaultLocale('test')); $this->assertAttributeEquals('test', '_defaultLocale', $o); $this->assertEquals('test', $o->getDefaultLocale()); }