[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/i18n/tests/cases/charset/ -> lmbUTF8BaseDriverTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/i18n/utf8.inc.php');
  10  lmb_require('limb/i18n/src/charset/lmbUTF8BaseDriver.class.php');
  11  lmb_require(dirname(__FILE__) . '/lmbMultiByteStringDriverTestBase.class.php');
  12  
  13  class lmbUTF8BaseDriverTest extends lmbMultiByteStringDriverTestBase
  14  {
  15    function _createDriver()
  16    {
  17      return new lmbUTF8BaseDriver();
  18    }
  19  
  20    function testToUnicodeAndBackToUtf8()
  21    {
  22      $driver = $this->_createDriver();
  23      $unicode = $driver->toUnicode("Iñtërnâtiônàlizætiøn");
  24  
  25      $this->assertEqual($unicode, array(73, 241, 116, 235, 114, 110, 226, 116, 105, 244, 110, 224,
  26                                         108, 105, 122, 230, 116, 105, 248, 110));
  27  
  28      $this->assertEqual($driver->toUTF8($unicode), "Iñtërnâtiônàlizætiøn");
  29    }
  30  
  31    function test_utf8_to_win1251()
  32    {
  33      $this->assertEqual(lmb_utf8_to_win1251("тесты"), chr(0xF2).chr(0xE5).chr(0xF1).chr(0xF2).chr(0xFB));
  34    }
  35  
  36    function test_win1251_to_utf8()
  37    {
  38      $this->assertEqual(lmb_win1251_to_utf8(chr(0xF2).chr(0xE5).chr(0xF1).chr(0xF2).chr(0xFB)), "тесты");
  39    }
  40  }
  41  
  42  ?>


Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7