[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/tests/inc/ -> utf8_romanize.test.php (source)

   1  <?php
   2  // use no mbstring help here
   3  if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1);
   4  
   5  /**
   6   * @group slow
   7   */
   8  class utf8_romanize_test extends DokuWikiTest {
   9  
  10      /**
  11       * Check Japanese romanization
  12       *
  13       * @author Denis Scheither <amorphis@uni-bremen.de>
  14       */
  15      function test_japanese(){
  16          $tests = file(dirname(__FILE__).'/utf8_kanaromaji.txt');
  17          $line = 1;
  18          foreach($tests as $test){
  19              list($jap,$rom) = explode(';',trim($test));
  20  
  21              $chk = \dokuwiki\Utf8\Clean::romanize($jap);
  22              $this->assertEquals($rom,$chk,"$jap\t->\t$chk\t!=\t$rom\t($line)");
  23              $line++;
  24          }
  25      }
  26  
  27      /**
  28       * Test romanization of character that would usually be deaccented in a different
  29       * way FS#1117
  30       *
  31       * @author Andreas Gohr <andi@splitbrain.org>
  32       */
  33      function test_deaccented(){
  34          $this->assertEquals("a A a A a o O",\dokuwiki\Utf8\Clean::romanize("å Å ä Ä ä ö Ö"));
  35      }
  36  
  37      /**
  38       * Greeklish romanization
  39       */
  40      function test_greeklish(){
  41          $this->assertEquals('kalimera pos eiste',\dokuwiki\Utf8\Clean::romanize('Καλημέρα πώς είστε'));
  42      }
  43  
  44  }
  45