5 require_once(CONST_LibDir.'/TokenList.php');
 
   8 class TokenTest extends \PHPUnit\Framework\TestCase
 
  10     protected function setUp(): void
 
  12         $this->oNormalizer = $this->getMockBuilder(\MockNormalizer::class)
 
  13                                   ->setMethods(array('transliterate'))
 
  15         $this->oNormalizer->method('transliterate')
 
  16                           ->will($this->returnCallback(function ($text) {
 
  17                               return strtolower($text);
 
  21     private function wordResult($aFields)
 
  29                  'country_code' => null,
 
  32         return array_merge($aRow, $aFields);
 
  35     public function testList()
 
  39         $this->assertEquals(0, $TL->count());
 
  41         $TL->addToken('word1', 'token1');
 
  42         $TL->addToken('word1', 'token2');
 
  44         $this->assertEquals(1, $TL->count());
 
  46         $this->assertTrue($TL->contains('word1'));
 
  47         $this->assertEquals(array('token1', 'token2'), $TL->get('word1'));
 
  49         $this->assertFalse($TL->contains('unknownword'));
 
  50         $this->assertEquals(array(), $TL->get('unknownword'));