LanguageZhTest.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /**
  3. * @covers LanguageZh
  4. * @covers LanguageZh_hans
  5. * @covers ZhConverter
  6. */
  7. class LanguageZhTest extends LanguageClassesTestCase {
  8. /**
  9. * @dataProvider provideAutoConvertToAllVariants
  10. * @covers Language::autoConvertToAllVariants
  11. */
  12. public function testAutoConvertToAllVariants( $result, $value ) {
  13. $this->assertEquals( $result, $this->getLang()->autoConvertToAllVariants( $value ) );
  14. }
  15. public static function provideAutoConvertToAllVariants() {
  16. return [
  17. // Plain hant -> hans
  18. [
  19. [
  20. 'zh' => '㑯',
  21. 'zh-hans' => '㑔',
  22. 'zh-hant' => '㑯',
  23. 'zh-cn' => '㑔',
  24. 'zh-hk' => '㑯',
  25. 'zh-mo' => '㑯',
  26. 'zh-my' => '㑔',
  27. 'zh-sg' => '㑔',
  28. 'zh-tw' => '㑯',
  29. ],
  30. '㑯'
  31. ],
  32. // Plain hans -> hant
  33. [
  34. [
  35. 'zh' => '㐷',
  36. 'zh-hans' => '㐷',
  37. 'zh-hant' => '傌',
  38. 'zh-cn' => '㐷',
  39. 'zh-hk' => '傌',
  40. 'zh-mo' => '傌',
  41. 'zh-my' => '㐷',
  42. 'zh-sg' => '㐷',
  43. 'zh-tw' => '傌',
  44. ],
  45. '㐷'
  46. ],
  47. // zh-cn specific
  48. [
  49. [
  50. 'zh' => '仲介',
  51. 'zh-hans' => '仲介',
  52. 'zh-hant' => '仲介',
  53. 'zh-cn' => '中介',
  54. 'zh-hk' => '仲介',
  55. 'zh-mo' => '仲介',
  56. 'zh-my' => '中介',
  57. 'zh-sg' => '中介',
  58. 'zh-tw' => '仲介',
  59. ],
  60. '仲介'
  61. ],
  62. // zh-hk specific
  63. [
  64. [
  65. 'zh' => '中文里',
  66. 'zh-hans' => '中文里',
  67. 'zh-hant' => '中文裡',
  68. 'zh-cn' => '中文里',
  69. 'zh-hk' => '中文裏',
  70. 'zh-mo' => '中文裏',
  71. 'zh-my' => '中文里',
  72. 'zh-sg' => '中文里',
  73. 'zh-tw' => '中文裡',
  74. ],
  75. '中文里'
  76. ],
  77. // zh-tw specific
  78. [
  79. [
  80. 'zh' => '甲肝',
  81. 'zh-hans' => '甲肝',
  82. 'zh-hant' => '甲肝',
  83. 'zh-cn' => '甲肝',
  84. 'zh-hk' => '甲肝',
  85. 'zh-mo' => '甲肝',
  86. 'zh-my' => '甲肝',
  87. 'zh-sg' => '甲肝',
  88. 'zh-tw' => 'A肝',
  89. ],
  90. '甲肝'
  91. ],
  92. // zh-tw overrides zh-hant
  93. [
  94. [
  95. 'zh' => '账',
  96. 'zh-hans' => '账',
  97. 'zh-hant' => '賬',
  98. 'zh-cn' => '账',
  99. 'zh-hk' => '賬',
  100. 'zh-mo' => '賬',
  101. 'zh-my' => '账',
  102. 'zh-sg' => '账',
  103. 'zh-tw' => '帳',
  104. ],
  105. '账'
  106. ],
  107. // zh-hk overrides zh-hant
  108. [
  109. [
  110. 'zh' => '一地里',
  111. 'zh-hans' => '一地里',
  112. 'zh-hant' => '一地裡',
  113. 'zh-cn' => '一地里',
  114. 'zh-hk' => '一地裏',
  115. 'zh-mo' => '一地裏',
  116. 'zh-my' => '一地里',
  117. 'zh-sg' => '一地里',
  118. 'zh-tw' => '一地裡',
  119. ],
  120. '一地里'
  121. ],
  122. ];
  123. }
  124. }