Source for file utf8_unicode.test.php

Documentation is available at utf8_unicode.test.php

  1. <?php
  2. /**
  3. @version $Id: utf8_unicode.test.php,v 1.1 2007/09/09 20:39:50 pitlinz Exp $
  4. @package utf8
  5. @subpackage Tests
  6. */
  7.  
  8. //--------------------------------------------------------------------
  9. /**
  10. * Includes
  11. @package utf8
  12. @subpackage Tests
  13. */
  14. require_once(dirname(__FILE__).'/../config.php');
  15. require_once UTF8 '/utils/unicode.php';
  16.  
  17. //--------------------------------------------------------------------
  18. /**
  19. @package utf8
  20. @subpackage Tests
  21. */
  22. class test_utf8_to_unicode extends UnitTestCase {
  23.  
  24.     function test_utf8_to_unicode({
  25.         $this->UnitTestCase('test_utf8_to_unicode()');
  26.     }
  27.     
  28.     function testEmptyString({
  29.         $this->assertEqual(utf8_to_unicode(''),array());
  30.     }
  31.     
  32.     function testString({
  33.         
  34.         $unicode array();
  35.         $unicode[073;
  36.         $unicode[1241;
  37.         $unicode[2116;
  38.         $unicode[3235;
  39.         $unicode[4114;
  40.         $unicode[5110;
  41.         $unicode[6226;
  42.         $unicode[7116;
  43.         $unicode[8105;
  44.         $unicode[9244;
  45.         $unicode[10110;
  46.         $unicode[11224;
  47.         $unicode[12108;
  48.         $unicode[13105;
  49.         $unicode[14122;
  50.         $unicode[15230;
  51.         $unicode[16116;
  52.         $unicode[17105;
  53.         $unicode[18248;
  54.         $unicode[19110;
  55.         
  56.         $this->assertEqual(utf8_to_unicode('Iñtërnâtiônàlizætiøn')$unicode);
  57.     }
  58.     
  59. }
  60.  
  61. //--------------------------------------------------------------------
  62. /**
  63. @package utf8
  64. @subpackage Tests
  65. */
  66. class test_utf8_from_unicode extends UnitTestCase {
  67.  
  68.     function test_utf8_strip_specials({
  69.         $this->UnitTestCase('test_utf8_strip_specials()');
  70.     }
  71.     
  72.     function testEmptyArray({
  73.         $this->assertEqual(utf8_from_unicode(array()),'');
  74.     }
  75.     
  76.     function testArray({
  77.         
  78.         $unicode array();
  79.         $unicode[073;
  80.         $unicode[1241;
  81.         $unicode[2116;
  82.         $unicode[3235;
  83.         $unicode[4114;
  84.         $unicode[5110;
  85.         $unicode[6226;
  86.         $unicode[7116;
  87.         $unicode[8105;
  88.         $unicode[9244;
  89.         $unicode[10110;
  90.         $unicode[11224;
  91.         $unicode[12108;
  92.         $unicode[13105;
  93.         $unicode[14122;
  94.         $unicode[15230;
  95.         $unicode[16116;
  96.         $unicode[17105;
  97.         $unicode[18248;
  98.         $unicode[19110;
  99.         
  100.         $this->assertEqual(utf8_from_unicode($unicode)'Iñtërnâtiônàlizætiøn');
  101.     }
  102.     
  103. }
  104.  
  105. //--------------------------------------------------------------------
  106. /**
  107. @package utf8
  108. @subpackage Tests
  109. */
  110. if (!defined('TEST_RUNNING')) {
  111.     define('TEST_RUNNING'true);
  112.     $test &new GroupTest('utf8_ascii');
  113.     $test->addTestCase(new test_utf8_to_unicode());
  114.     $test->addTestCase(new test_utf8_from_unicode());
  115.     $reporter getTestReporter();
  116.     $test->run($reporter);
  117. }

Documentation generated on Thu, 08 Jan 2009 17:49:22 +0100 by phpDocumentor 1.4.0a2