/lib/Cake/Test/Case/I18n/I18nTest.php

https://github.com/masihnewbie/cakephp · PHP · 845 lines · 682 code · 68 blank · 95 comment · 0 complexity · 79fc62ece80e62c1740d22687a528c95 MD5 · raw file

  1. <?php
  2. /**
  3. * I18nTest file
  4. *
  5. * PHP 5
  6. *
  7. * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
  8. * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * Redistributions of files must retain the above copyright notice
  12. *
  13. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
  15. * @package Cake.Test.Case.I18n
  16. * @since CakePHP(tm) v 1.2.0.5432
  17. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  18. */
  19. App::uses('I18n', 'I18n');
  20. /**
  21. * I18nTest class
  22. *
  23. * @package Cake.Test.Case.I18n
  24. */
  25. class I18nTest extends CakeTestCase {
  26. /**
  27. * setUp method
  28. *
  29. * @return void
  30. */
  31. public function setUp() {
  32. Cache::delete('object_map', '_cake_core_');
  33. App::build(array(
  34. 'locales' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS),
  35. 'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
  36. ), true);
  37. CakePlugin::loadAll();
  38. }
  39. /**
  40. * tearDown method
  41. *
  42. * @return void
  43. */
  44. public function tearDown() {
  45. Cache::delete('object_map', '_cake_core_');
  46. App::build();
  47. CakePlugin::unload();
  48. }
  49. public function testTranslationCaching() {
  50. Configure::write('Config.language', 'cache_test_po');
  51. $i18n = i18n::getInstance();
  52. // reset internally stored entries
  53. I18n::clear();
  54. Cache::clear(false, '_cake_core_');
  55. $lang = Configure::read('Config.language');#$i18n->l10n->locale;
  56. Cache::config('_cake_core_', Cache::config('default'));
  57. // make some calls to translate using different domains
  58. $this->assertEqual('Dom 1 Foo', I18n::translate('dom1.foo', false, 'dom1'));
  59. $this->assertEqual('Dom 1 Bar', I18n::translate('dom1.bar', false, 'dom1'));
  60. $domains = I18n::domains();
  61. $this->assertEqual('Dom 1 Foo', $domains['dom1']['cache_test_po']['LC_MESSAGES']['dom1.foo']);
  62. // reset internally stored entries
  63. I18n::clear();
  64. // now only dom1 should be in cache
  65. $cachedDom1 = Cache::read('dom1_' . $lang, '_cake_core_');
  66. $this->assertEqual('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']);
  67. $this->assertEqual('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']);
  68. // dom2 not in cache
  69. $this->assertFalse(Cache::read('dom2_' . $lang, '_cake_core_'));
  70. // translate a item of dom2 (adds dom2 to cache)
  71. $this->assertEqual('Dom 2 Foo', I18n::translate('dom2.foo', false, 'dom2'));
  72. // verify dom2 was cached through manual read from cache
  73. $cachedDom2 = Cache::read('dom2_' . $lang, '_cake_core_');
  74. $this->assertEqual('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']);
  75. $this->assertEqual('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']);
  76. // modify cache entry manually to verify that dom1 entries now will be read from cache
  77. $cachedDom1['LC_MESSAGES']['dom1.foo'] = 'FOO';
  78. Cache::write('dom1_' . $lang, $cachedDom1, '_cake_core_');
  79. $this->assertEqual('FOO', I18n::translate('dom1.foo', false, 'dom1'));
  80. }
  81. /**
  82. * testDefaultStrings method
  83. *
  84. * @return void
  85. */
  86. public function testDefaultStrings() {
  87. $singular = $this->__singular();
  88. $this->assertEqual('Plural Rule 1', $singular);
  89. $plurals = $this->__plural();
  90. $this->assertTrue(in_array('0 = 0 or > 1', $plurals));
  91. $this->assertTrue(in_array('1 = 1', $plurals));
  92. $this->assertTrue(in_array('2 = 0 or > 1', $plurals));
  93. $this->assertTrue(in_array('3 = 0 or > 1', $plurals));
  94. $this->assertTrue(in_array('4 = 0 or > 1', $plurals));
  95. $this->assertTrue(in_array('5 = 0 or > 1', $plurals));
  96. $this->assertTrue(in_array('6 = 0 or > 1', $plurals));
  97. $this->assertTrue(in_array('7 = 0 or > 1', $plurals));
  98. $this->assertTrue(in_array('8 = 0 or > 1', $plurals));
  99. $this->assertTrue(in_array('9 = 0 or > 1', $plurals));
  100. $this->assertTrue(in_array('10 = 0 or > 1', $plurals));
  101. $this->assertTrue(in_array('11 = 0 or > 1', $plurals));
  102. $this->assertTrue(in_array('12 = 0 or > 1', $plurals));
  103. $this->assertTrue(in_array('13 = 0 or > 1', $plurals));
  104. $this->assertTrue(in_array('14 = 0 or > 1', $plurals));
  105. $this->assertTrue(in_array('15 = 0 or > 1', $plurals));
  106. $this->assertTrue(in_array('16 = 0 or > 1', $plurals));
  107. $this->assertTrue(in_array('17 = 0 or > 1', $plurals));
  108. $this->assertTrue(in_array('18 = 0 or > 1', $plurals));
  109. $this->assertTrue(in_array('19 = 0 or > 1', $plurals));
  110. $this->assertTrue(in_array('20 = 0 or > 1', $plurals));
  111. $this->assertTrue(in_array('21 = 0 or > 1', $plurals));
  112. $this->assertTrue(in_array('22 = 0 or > 1', $plurals));
  113. $this->assertTrue(in_array('23 = 0 or > 1', $plurals));
  114. $this->assertTrue(in_array('24 = 0 or > 1', $plurals));
  115. $this->assertTrue(in_array('25 = 0 or > 1', $plurals));
  116. $coreSingular = $this->__singularFromCore();
  117. $this->assertEqual('Plural Rule 1 (from core)', $coreSingular);
  118. $corePlurals = $this->__pluralFromCore();
  119. $this->assertTrue(in_array('0 = 0 or > 1 (from core)', $corePlurals));
  120. $this->assertTrue(in_array('1 = 1 (from core)', $corePlurals));
  121. $this->assertTrue(in_array('2 = 0 or > 1 (from core)', $corePlurals));
  122. $this->assertTrue(in_array('3 = 0 or > 1 (from core)', $corePlurals));
  123. $this->assertTrue(in_array('4 = 0 or > 1 (from core)', $corePlurals));
  124. $this->assertTrue(in_array('5 = 0 or > 1 (from core)', $corePlurals));
  125. $this->assertTrue(in_array('6 = 0 or > 1 (from core)', $corePlurals));
  126. $this->assertTrue(in_array('7 = 0 or > 1 (from core)', $corePlurals));
  127. $this->assertTrue(in_array('8 = 0 or > 1 (from core)', $corePlurals));
  128. $this->assertTrue(in_array('9 = 0 or > 1 (from core)', $corePlurals));
  129. $this->assertTrue(in_array('10 = 0 or > 1 (from core)', $corePlurals));
  130. $this->assertTrue(in_array('11 = 0 or > 1 (from core)', $corePlurals));
  131. $this->assertTrue(in_array('12 = 0 or > 1 (from core)', $corePlurals));
  132. $this->assertTrue(in_array('13 = 0 or > 1 (from core)', $corePlurals));
  133. $this->assertTrue(in_array('14 = 0 or > 1 (from core)', $corePlurals));
  134. $this->assertTrue(in_array('15 = 0 or > 1 (from core)', $corePlurals));
  135. $this->assertTrue(in_array('16 = 0 or > 1 (from core)', $corePlurals));
  136. $this->assertTrue(in_array('17 = 0 or > 1 (from core)', $corePlurals));
  137. $this->assertTrue(in_array('18 = 0 or > 1 (from core)', $corePlurals));
  138. $this->assertTrue(in_array('19 = 0 or > 1 (from core)', $corePlurals));
  139. $this->assertTrue(in_array('20 = 0 or > 1 (from core)', $corePlurals));
  140. $this->assertTrue(in_array('21 = 0 or > 1 (from core)', $corePlurals));
  141. $this->assertTrue(in_array('22 = 0 or > 1 (from core)', $corePlurals));
  142. $this->assertTrue(in_array('23 = 0 or > 1 (from core)', $corePlurals));
  143. $this->assertTrue(in_array('24 = 0 or > 1 (from core)', $corePlurals));
  144. $this->assertTrue(in_array('25 = 0 or > 1 (from core)', $corePlurals));
  145. }
  146. /**
  147. * testPoRulesZero method
  148. *
  149. * @return void
  150. */
  151. public function testPoRulesZero() {
  152. Configure::write('Config.language', 'rule_0_po');
  153. $singular = $this->__singular();
  154. $this->assertEqual('Plural Rule 0 (translated)', $singular);
  155. $plurals = $this->__plural();
  156. $this->assertTrue(in_array('0 ends with any # (translated)', $plurals));
  157. $this->assertTrue(in_array('1 ends with any # (translated)', $plurals));
  158. $this->assertTrue(in_array('2 ends with any # (translated)', $plurals));
  159. $this->assertTrue(in_array('3 ends with any # (translated)', $plurals));
  160. $this->assertTrue(in_array('4 ends with any # (translated)', $plurals));
  161. $this->assertTrue(in_array('5 ends with any # (translated)', $plurals));
  162. $this->assertTrue(in_array('6 ends with any # (translated)', $plurals));
  163. $this->assertTrue(in_array('7 ends with any # (translated)', $plurals));
  164. $this->assertTrue(in_array('8 ends with any # (translated)', $plurals));
  165. $this->assertTrue(in_array('9 ends with any # (translated)', $plurals));
  166. $this->assertTrue(in_array('10 ends with any # (translated)', $plurals));
  167. $this->assertTrue(in_array('11 ends with any # (translated)', $plurals));
  168. $this->assertTrue(in_array('12 ends with any # (translated)', $plurals));
  169. $this->assertTrue(in_array('13 ends with any # (translated)', $plurals));
  170. $this->assertTrue(in_array('14 ends with any # (translated)', $plurals));
  171. $this->assertTrue(in_array('15 ends with any # (translated)', $plurals));
  172. $this->assertTrue(in_array('16 ends with any # (translated)', $plurals));
  173. $this->assertTrue(in_array('17 ends with any # (translated)', $plurals));
  174. $this->assertTrue(in_array('18 ends with any # (translated)', $plurals));
  175. $this->assertTrue(in_array('19 ends with any # (translated)', $plurals));
  176. $this->assertTrue(in_array('20 ends with any # (translated)', $plurals));
  177. $this->assertTrue(in_array('21 ends with any # (translated)', $plurals));
  178. $this->assertTrue(in_array('22 ends with any # (translated)', $plurals));
  179. $this->assertTrue(in_array('23 ends with any # (translated)', $plurals));
  180. $this->assertTrue(in_array('24 ends with any # (translated)', $plurals));
  181. $this->assertTrue(in_array('25 ends with any # (translated)', $plurals));
  182. $coreSingular = $this->__singularFromCore();
  183. $this->assertEqual('Plural Rule 0 (from core translated)', $coreSingular);
  184. $corePlurals = $this->__pluralFromCore();
  185. $this->assertTrue(in_array('0 ends with any # (from core translated)', $corePlurals));
  186. $this->assertTrue(in_array('1 ends with any # (from core translated)', $corePlurals));
  187. $this->assertTrue(in_array('2 ends with any # (from core translated)', $corePlurals));
  188. $this->assertTrue(in_array('3 ends with any # (from core translated)', $corePlurals));
  189. $this->assertTrue(in_array('4 ends with any # (from core translated)', $corePlurals));
  190. $this->assertTrue(in_array('5 ends with any # (from core translated)', $corePlurals));
  191. $this->assertTrue(in_array('6 ends with any # (from core translated)', $corePlurals));
  192. $this->assertTrue(in_array('7 ends with any # (from core translated)', $corePlurals));
  193. $this->assertTrue(in_array('8 ends with any # (from core translated)', $corePlurals));
  194. $this->assertTrue(in_array('9 ends with any # (from core translated)', $corePlurals));
  195. $this->assertTrue(in_array('10 ends with any # (from core translated)', $corePlurals));
  196. $this->assertTrue(in_array('11 ends with any # (from core translated)', $corePlurals));
  197. $this->assertTrue(in_array('12 ends with any # (from core translated)', $corePlurals));
  198. $this->assertTrue(in_array('13 ends with any # (from core translated)', $corePlurals));
  199. $this->assertTrue(in_array('14 ends with any # (from core translated)', $corePlurals));
  200. $this->assertTrue(in_array('15 ends with any # (from core translated)', $corePlurals));
  201. $this->assertTrue(in_array('16 ends with any # (from core translated)', $corePlurals));
  202. $this->assertTrue(in_array('17 ends with any # (from core translated)', $corePlurals));
  203. $this->assertTrue(in_array('18 ends with any # (from core translated)', $corePlurals));
  204. $this->assertTrue(in_array('19 ends with any # (from core translated)', $corePlurals));
  205. $this->assertTrue(in_array('20 ends with any # (from core translated)', $corePlurals));
  206. $this->assertTrue(in_array('21 ends with any # (from core translated)', $corePlurals));
  207. $this->assertTrue(in_array('22 ends with any # (from core translated)', $corePlurals));
  208. $this->assertTrue(in_array('23 ends with any # (from core translated)', $corePlurals));
  209. $this->assertTrue(in_array('24 ends with any # (from core translated)', $corePlurals));
  210. $this->assertTrue(in_array('25 ends with any # (from core translated)', $corePlurals));
  211. }
  212. /**
  213. * testMoRulesZero method
  214. *
  215. * @return void
  216. */
  217. public function testMoRulesZero() {
  218. Configure::write('Config.language', 'rule_0_mo');
  219. $singular = $this->__singular();
  220. $this->assertEqual('Plural Rule 0 (translated)', $singular);
  221. $plurals = $this->__plural();
  222. $this->assertTrue(in_array('0 ends with any # (translated)', $plurals));
  223. $this->assertTrue(in_array('1 ends with any # (translated)', $plurals));
  224. $this->assertTrue(in_array('2 ends with any # (translated)', $plurals));
  225. $this->assertTrue(in_array('3 ends with any # (translated)', $plurals));
  226. $this->assertTrue(in_array('4 ends with any # (translated)', $plurals));
  227. $this->assertTrue(in_array('5 ends with any # (translated)', $plurals));
  228. $this->assertTrue(in_array('6 ends with any # (translated)', $plurals));
  229. $this->assertTrue(in_array('7 ends with any # (translated)', $plurals));
  230. $this->assertTrue(in_array('8 ends with any # (translated)', $plurals));
  231. $this->assertTrue(in_array('9 ends with any # (translated)', $plurals));
  232. $this->assertTrue(in_array('10 ends with any # (translated)', $plurals));
  233. $this->assertTrue(in_array('11 ends with any # (translated)', $plurals));
  234. $this->assertTrue(in_array('12 ends with any # (translated)', $plurals));
  235. $this->assertTrue(in_array('13 ends with any # (translated)', $plurals));
  236. $this->assertTrue(in_array('14 ends with any # (translated)', $plurals));
  237. $this->assertTrue(in_array('15 ends with any # (translated)', $plurals));
  238. $this->assertTrue(in_array('16 ends with any # (translated)', $plurals));
  239. $this->assertTrue(in_array('17 ends with any # (translated)', $plurals));
  240. $this->assertTrue(in_array('18 ends with any # (translated)', $plurals));
  241. $this->assertTrue(in_array('19 ends with any # (translated)', $plurals));
  242. $this->assertTrue(in_array('20 ends with any # (translated)', $plurals));
  243. $this->assertTrue(in_array('21 ends with any # (translated)', $plurals));
  244. $this->assertTrue(in_array('22 ends with any # (translated)', $plurals));
  245. $this->assertTrue(in_array('23 ends with any # (translated)', $plurals));
  246. $this->assertTrue(in_array('24 ends with any # (translated)', $plurals));
  247. $this->assertTrue(in_array('25 ends with any # (translated)', $plurals));
  248. $coreSingular = $this->__singularFromCore();
  249. $this->assertEqual('Plural Rule 0 (from core translated)', $coreSingular);
  250. $corePlurals = $this->__pluralFromCore();
  251. $this->assertTrue(in_array('0 ends with any # (from core translated)', $corePlurals));
  252. $this->assertTrue(in_array('1 ends with any # (from core translated)', $corePlurals));
  253. $this->assertTrue(in_array('2 ends with any # (from core translated)', $corePlurals));
  254. $this->assertTrue(in_array('3 ends with any # (from core translated)', $corePlurals));
  255. $this->assertTrue(in_array('4 ends with any # (from core translated)', $corePlurals));
  256. $this->assertTrue(in_array('5 ends with any # (from core translated)', $corePlurals));
  257. $this->assertTrue(in_array('6 ends with any # (from core translated)', $corePlurals));
  258. $this->assertTrue(in_array('7 ends with any # (from core translated)', $corePlurals));
  259. $this->assertTrue(in_array('8 ends with any # (from core translated)', $corePlurals));
  260. $this->assertTrue(in_array('9 ends with any # (from core translated)', $corePlurals));
  261. $this->assertTrue(in_array('10 ends with any # (from core translated)', $corePlurals));
  262. $this->assertTrue(in_array('11 ends with any # (from core translated)', $corePlurals));
  263. $this->assertTrue(in_array('12 ends with any # (from core translated)', $corePlurals));
  264. $this->assertTrue(in_array('13 ends with any # (from core translated)', $corePlurals));
  265. $this->assertTrue(in_array('14 ends with any # (from core translated)', $corePlurals));
  266. $this->assertTrue(in_array('15 ends with any # (from core translated)', $corePlurals));
  267. $this->assertTrue(in_array('16 ends with any # (from core translated)', $corePlurals));
  268. $this->assertTrue(in_array('17 ends with any # (from core translated)', $corePlurals));
  269. $this->assertTrue(in_array('18 ends with any # (from core translated)', $corePlurals));
  270. $this->assertTrue(in_array('19 ends with any # (from core translated)', $corePlurals));
  271. $this->assertTrue(in_array('20 ends with any # (from core translated)', $corePlurals));
  272. $this->assertTrue(in_array('21 ends with any # (from core translated)', $corePlurals));
  273. $this->assertTrue(in_array('22 ends with any # (from core translated)', $corePlurals));
  274. $this->assertTrue(in_array('23 ends with any # (from core translated)', $corePlurals));
  275. $this->assertTrue(in_array('24 ends with any # (from core translated)', $corePlurals));
  276. $this->assertTrue(in_array('25 ends with any # (from core translated)', $corePlurals));
  277. }
  278. /**
  279. * testPoRulesOne method
  280. *
  281. * @return void
  282. */
  283. public function testPoRulesOne() {
  284. Configure::write('Config.language', 'rule_1_po');
  285. $singular = $this->__singular();
  286. $this->assertEqual('Plural Rule 1 (translated)', $singular);
  287. $plurals = $this->__plural();
  288. $this->assertTrue(in_array('0 = 0 or > 1 (translated)', $plurals));
  289. $this->assertTrue(in_array('1 = 1 (translated)', $plurals));
  290. $this->assertTrue(in_array('2 = 0 or > 1 (translated)', $plurals));
  291. $this->assertTrue(in_array('3 = 0 or > 1 (translated)', $plurals));
  292. $this->assertTrue(in_array('4 = 0 or > 1 (translated)', $plurals));
  293. $this->assertTrue(in_array('5 = 0 or > 1 (translated)', $plurals));
  294. $this->assertTrue(in_array('6 = 0 or > 1 (translated)', $plurals));
  295. $this->assertTrue(in_array('7 = 0 or > 1 (translated)', $plurals));
  296. $this->assertTrue(in_array('8 = 0 or > 1 (translated)', $plurals));
  297. $this->assertTrue(in_array('9 = 0 or > 1 (translated)', $plurals));
  298. $this->assertTrue(in_array('10 = 0 or > 1 (translated)', $plurals));
  299. $this->assertTrue(in_array('11 = 0 or > 1 (translated)', $plurals));
  300. $this->assertTrue(in_array('12 = 0 or > 1 (translated)', $plurals));
  301. $this->assertTrue(in_array('13 = 0 or > 1 (translated)', $plurals));
  302. $this->assertTrue(in_array('14 = 0 or > 1 (translated)', $plurals));
  303. $this->assertTrue(in_array('15 = 0 or > 1 (translated)', $plurals));
  304. $this->assertTrue(in_array('16 = 0 or > 1 (translated)', $plurals));
  305. $this->assertTrue(in_array('17 = 0 or > 1 (translated)', $plurals));
  306. $this->assertTrue(in_array('18 = 0 or > 1 (translated)', $plurals));
  307. $this->assertTrue(in_array('19 = 0 or > 1 (translated)', $plurals));
  308. $this->assertTrue(in_array('20 = 0 or > 1 (translated)', $plurals));
  309. $this->assertTrue(in_array('21 = 0 or > 1 (translated)', $plurals));
  310. $this->assertTrue(in_array('22 = 0 or > 1 (translated)', $plurals));
  311. $this->assertTrue(in_array('23 = 0 or > 1 (translated)', $plurals));
  312. $this->assertTrue(in_array('24 = 0 or > 1 (translated)', $plurals));
  313. $this->assertTrue(in_array('25 = 0 or > 1 (translated)', $plurals));
  314. $coreSingular = $this->__singularFromCore();
  315. $this->assertEqual('Plural Rule 1 (from core translated)', $coreSingular);
  316. $corePlurals = $this->__pluralFromCore();
  317. $this->assertTrue(in_array('0 = 0 or > 1 (from core translated)', $corePlurals));
  318. $this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals));
  319. $this->assertTrue(in_array('2 = 0 or > 1 (from core translated)', $corePlurals));
  320. $this->assertTrue(in_array('3 = 0 or > 1 (from core translated)', $corePlurals));
  321. $this->assertTrue(in_array('4 = 0 or > 1 (from core translated)', $corePlurals));
  322. $this->assertTrue(in_array('5 = 0 or > 1 (from core translated)', $corePlurals));
  323. $this->assertTrue(in_array('6 = 0 or > 1 (from core translated)', $corePlurals));
  324. $this->assertTrue(in_array('7 = 0 or > 1 (from core translated)', $corePlurals));
  325. $this->assertTrue(in_array('8 = 0 or > 1 (from core translated)', $corePlurals));
  326. $this->assertTrue(in_array('9 = 0 or > 1 (from core translated)', $corePlurals));
  327. $this->assertTrue(in_array('10 = 0 or > 1 (from core translated)', $corePlurals));
  328. $this->assertTrue(in_array('11 = 0 or > 1 (from core translated)', $corePlurals));
  329. $this->assertTrue(in_array('12 = 0 or > 1 (from core translated)', $corePlurals));
  330. $this->assertTrue(in_array('13 = 0 or > 1 (from core translated)', $corePlurals));
  331. $this->assertTrue(in_array('14 = 0 or > 1 (from core translated)', $corePlurals));
  332. $this->assertTrue(in_array('15 = 0 or > 1 (from core translated)', $corePlurals));
  333. $this->assertTrue(in_array('16 = 0 or > 1 (from core translated)', $corePlurals));
  334. $this->assertTrue(in_array('17 = 0 or > 1 (from core translated)', $corePlurals));
  335. $this->assertTrue(in_array('18 = 0 or > 1 (from core translated)', $corePlurals));
  336. $this->assertTrue(in_array('19 = 0 or > 1 (from core translated)', $corePlurals));
  337. $this->assertTrue(in_array('20 = 0 or > 1 (from core translated)', $corePlurals));
  338. $this->assertTrue(in_array('21 = 0 or > 1 (from core translated)', $corePlurals));
  339. $this->assertTrue(in_array('22 = 0 or > 1 (from core translated)', $corePlurals));
  340. $this->assertTrue(in_array('23 = 0 or > 1 (from core translated)', $corePlurals));
  341. $this->assertTrue(in_array('24 = 0 or > 1 (from core translated)', $corePlurals));
  342. $this->assertTrue(in_array('25 = 0 or > 1 (from core translated)', $corePlurals));
  343. }
  344. /**
  345. * testMoRulesOne method
  346. *
  347. * @return void
  348. */
  349. public function testMoRulesOne() {
  350. Configure::write('Config.language', 'rule_1_mo');
  351. $singular = $this->__singular();
  352. $this->assertEqual('Plural Rule 1 (translated)', $singular);
  353. $plurals = $this->__plural();
  354. $this->assertTrue(in_array('0 = 0 or > 1 (translated)', $plurals));
  355. $this->assertTrue(in_array('1 = 1 (translated)', $plurals));
  356. $this->assertTrue(in_array('2 = 0 or > 1 (translated)', $plurals));
  357. $this->assertTrue(in_array('3 = 0 or > 1 (translated)', $plurals));
  358. $this->assertTrue(in_array('4 = 0 or > 1 (translated)', $plurals));
  359. $this->assertTrue(in_array('5 = 0 or > 1 (translated)', $plurals));
  360. $this->assertTrue(in_array('6 = 0 or > 1 (translated)', $plurals));
  361. $this->assertTrue(in_array('7 = 0 or > 1 (translated)', $plurals));
  362. $this->assertTrue(in_array('8 = 0 or > 1 (translated)', $plurals));
  363. $this->assertTrue(in_array('9 = 0 or > 1 (translated)', $plurals));
  364. $this->assertTrue(in_array('10 = 0 or > 1 (translated)', $plurals));
  365. $this->assertTrue(in_array('11 = 0 or > 1 (translated)', $plurals));
  366. $this->assertTrue(in_array('12 = 0 or > 1 (translated)', $plurals));
  367. $this->assertTrue(in_array('13 = 0 or > 1 (translated)', $plurals));
  368. $this->assertTrue(in_array('14 = 0 or > 1 (translated)', $plurals));
  369. $this->assertTrue(in_array('15 = 0 or > 1 (translated)', $plurals));
  370. $this->assertTrue(in_array('16 = 0 or > 1 (translated)', $plurals));
  371. $this->assertTrue(in_array('17 = 0 or > 1 (translated)', $plurals));
  372. $this->assertTrue(in_array('18 = 0 or > 1 (translated)', $plurals));
  373. $this->assertTrue(in_array('19 = 0 or > 1 (translated)', $plurals));
  374. $this->assertTrue(in_array('20 = 0 or > 1 (translated)', $plurals));
  375. $this->assertTrue(in_array('21 = 0 or > 1 (translated)', $plurals));
  376. $this->assertTrue(in_array('22 = 0 or > 1 (translated)', $plurals));
  377. $this->assertTrue(in_array('23 = 0 or > 1 (translated)', $plurals));
  378. $this->assertTrue(in_array('24 = 0 or > 1 (translated)', $plurals));
  379. $this->assertTrue(in_array('25 = 0 or > 1 (translated)', $plurals));
  380. $coreSingular = $this->__singularFromCore();
  381. $this->assertEqual('Plural Rule 1 (from core translated)', $coreSingular);
  382. $corePlurals = $this->__pluralFromCore();
  383. $this->assertTrue(in_array('0 = 0 or > 1 (from core translated)', $corePlurals));
  384. $this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals));
  385. $this->assertTrue(in_array('2 = 0 or > 1 (from core translated)', $corePlurals));
  386. $this->assertTrue(in_array('3 = 0 or > 1 (from core translated)', $corePlurals));
  387. $this->assertTrue(in_array('4 = 0 or > 1 (from core translated)', $corePlurals));
  388. $this->assertTrue(in_array('5 = 0 or > 1 (from core translated)', $corePlurals));
  389. $this->assertTrue(in_array('6 = 0 or > 1 (from core translated)', $corePlurals));
  390. $this->assertTrue(in_array('7 = 0 or > 1 (from core translated)', $corePlurals));
  391. $this->assertTrue(in_array('8 = 0 or > 1 (from core translated)', $corePlurals));
  392. $this->assertTrue(in_array('9 = 0 or > 1 (from core translated)', $corePlurals));
  393. $this->assertTrue(in_array('10 = 0 or > 1 (from core translated)', $corePlurals));
  394. $this->assertTrue(in_array('11 = 0 or > 1 (from core translated)', $corePlurals));
  395. $this->assertTrue(in_array('12 = 0 or > 1 (from core translated)', $corePlurals));
  396. $this->assertTrue(in_array('13 = 0 or > 1 (from core translated)', $corePlurals));
  397. $this->assertTrue(in_array('14 = 0 or > 1 (from core translated)', $corePlurals));
  398. $this->assertTrue(in_array('15 = 0 or > 1 (from core translated)', $corePlurals));
  399. $this->assertTrue(in_array('16 = 0 or > 1 (from core translated)', $corePlurals));
  400. $this->assertTrue(in_array('17 = 0 or > 1 (from core translated)', $corePlurals));
  401. $this->assertTrue(in_array('18 = 0 or > 1 (from core translated)', $corePlurals));
  402. $this->assertTrue(in_array('19 = 0 or > 1 (from core translated)', $corePlurals));
  403. $this->assertTrue(in_array('20 = 0 or > 1 (from core translated)', $corePlurals));
  404. $this->assertTrue(in_array('21 = 0 or > 1 (from core translated)', $corePlurals));
  405. $this->assertTrue(in_array('22 = 0 or > 1 (from core translated)', $corePlurals));
  406. $this->assertTrue(in_array('23 = 0 or > 1 (from core translated)', $corePlurals));
  407. $this->assertTrue(in_array('24 = 0 or > 1 (from core translated)', $corePlurals));
  408. $this->assertTrue(in_array('25 = 0 or > 1 (from core translated)', $corePlurals));
  409. }
  410. /**
  411. * testPoRulesTwo method
  412. *
  413. * @return void
  414. */
  415. public function testPoRulesTwo() {
  416. Configure::write('Config.language', 'rule_2_po');
  417. $singular = $this->__singular();
  418. $this->assertEqual('Plural Rule 2 (translated)', $singular);
  419. $plurals = $this->__plural();
  420. $this->assertTrue(in_array('0 = 0 or 1 (translated)', $plurals));
  421. $this->assertTrue(in_array('1 = 0 or 1 (translated)', $plurals));
  422. $this->assertTrue(in_array('2 > 1 (translated)', $plurals));
  423. $this->assertTrue(in_array('3 > 1 (translated)', $plurals));
  424. $this->assertTrue(in_array('4 > 1 (translated)', $plurals));
  425. $this->assertTrue(in_array('5 > 1 (translated)', $plurals));
  426. $this->assertTrue(in_array('6 > 1 (translated)', $plurals));
  427. $this->assertTrue(in_array('7 > 1 (translated)', $plurals));
  428. $this->assertTrue(in_array('8 > 1 (translated)', $plurals));
  429. $this->assertTrue(in_array('9 > 1 (translated)', $plurals));
  430. $this->assertTrue(in_array('10 > 1 (translated)', $plurals));
  431. $this->assertTrue(in_array('11 > 1 (translated)', $plurals));
  432. $this->assertTrue(in_array('12 > 1 (translated)', $plurals));
  433. $this->assertTrue(in_array('13 > 1 (translated)', $plurals));
  434. $this->assertTrue(in_array('14 > 1 (translated)', $plurals));
  435. $this->assertTrue(in_array('15 > 1 (translated)', $plurals));
  436. $this->assertTrue(in_array('16 > 1 (translated)', $plurals));
  437. $this->assertTrue(in_array('17 > 1 (translated)', $plurals));
  438. $this->assertTrue(in_array('18 > 1 (translated)', $plurals));
  439. $this->assertTrue(in_array('19 > 1 (translated)', $plurals));
  440. $this->assertTrue(in_array('20 > 1 (translated)', $plurals));
  441. $this->assertTrue(in_array('21 > 1 (translated)', $plurals));
  442. $this->assertTrue(in_array('22 > 1 (translated)', $plurals));
  443. $this->assertTrue(in_array('23 > 1 (translated)', $plurals));
  444. $this->assertTrue(in_array('24 > 1 (translated)', $plurals));
  445. $this->assertTrue(in_array('25 > 1 (translated)', $plurals));
  446. $coreSingular = $this->__singularFromCore();
  447. $this->assertEqual('Plural Rule 2 (from core translated)', $coreSingular);
  448. $corePlurals = $this->__pluralFromCore();
  449. $this->assertTrue(in_array('0 = 0 or 1 (from core translated)', $corePlurals));
  450. $this->assertTrue(in_array('1 = 0 or 1 (from core translated)', $corePlurals));
  451. $this->assertTrue(in_array('2 > 1 (from core translated)', $corePlurals));
  452. $this->assertTrue(in_array('3 > 1 (from core translated)', $corePlurals));
  453. $this->assertTrue(in_array('4 > 1 (from core translated)', $corePlurals));
  454. $this->assertTrue(in_array('5 > 1 (from core translated)', $corePlurals));
  455. $this->assertTrue(in_array('6 > 1 (from core translated)', $corePlurals));
  456. $this->assertTrue(in_array('7 > 1 (from core translated)', $corePlurals));
  457. $this->assertTrue(in_array('8 > 1 (from core translated)', $corePlurals));
  458. $this->assertTrue(in_array('9 > 1 (from core translated)', $corePlurals));
  459. $this->assertTrue(in_array('10 > 1 (from core translated)', $corePlurals));
  460. $this->assertTrue(in_array('11 > 1 (from core translated)', $corePlurals));
  461. $this->assertTrue(in_array('12 > 1 (from core translated)', $corePlurals));
  462. $this->assertTrue(in_array('13 > 1 (from core translated)', $corePlurals));
  463. $this->assertTrue(in_array('14 > 1 (from core translated)', $corePlurals));
  464. $this->assertTrue(in_array('15 > 1 (from core translated)', $corePlurals));
  465. $this->assertTrue(in_array('16 > 1 (from core translated)', $corePlurals));
  466. $this->assertTrue(in_array('17 > 1 (from core translated)', $corePlurals));
  467. $this->assertTrue(in_array('18 > 1 (from core translated)', $corePlurals));
  468. $this->assertTrue(in_array('19 > 1 (from core translated)', $corePlurals));
  469. $this->assertTrue(in_array('20 > 1 (from core translated)', $corePlurals));
  470. $this->assertTrue(in_array('21 > 1 (from core translated)', $corePlurals));
  471. $this->assertTrue(in_array('22 > 1 (from core translated)', $corePlurals));
  472. $this->assertTrue(in_array('23 > 1 (from core translated)', $corePlurals));
  473. $this->assertTrue(in_array('24 > 1 (from core translated)', $corePlurals));
  474. $this->assertTrue(in_array('25 > 1 (from core translated)', $corePlurals));
  475. }
  476. /**
  477. * testMoRulesTwo method
  478. *
  479. * @return void
  480. */
  481. public function testMoRulesTwo() {
  482. Configure::write('Config.language', 'rule_2_mo');
  483. $singular = $this->__singular();
  484. $this->assertEqual('Plural Rule 2 (translated)', $singular);
  485. $plurals = $this->__plural();
  486. $this->assertTrue(in_array('0 = 0 or 1 (translated)', $plurals));
  487. $this->assertTrue(in_array('1 = 0 or 1 (translated)', $plurals));
  488. $this->assertTrue(in_array('2 > 1 (translated)', $plurals));
  489. $this->assertTrue(in_array('3 > 1 (translated)', $plurals));
  490. $this->assertTrue(in_array('4 > 1 (translated)', $plurals));
  491. $this->assertTrue(in_array('5 > 1 (translated)', $plurals));
  492. $this->assertTrue(in_array('6 > 1 (translated)', $plurals));
  493. $this->assertTrue(in_array('7 > 1 (translated)', $plurals));
  494. $this->assertTrue(in_array('8 > 1 (translated)', $plurals));
  495. $this->assertTrue(in_array('9 > 1 (translated)', $plurals));
  496. $this->assertTrue(in_array('10 > 1 (translated)', $plurals));
  497. $this->assertTrue(in_array('11 > 1 (translated)', $plurals));
  498. $this->assertTrue(in_array('12 > 1 (translated)', $plurals));
  499. $this->assertTrue(in_array('13 > 1 (translated)', $plurals));
  500. $this->assertTrue(in_array('14 > 1 (translated)', $plurals));
  501. $this->assertTrue(in_array('15 > 1 (translated)', $plurals));
  502. $this->assertTrue(in_array('16 > 1 (translated)', $plurals));
  503. $this->assertTrue(in_array('17 > 1 (translated)', $plurals));
  504. $this->assertTrue(in_array('18 > 1 (translated)', $plurals));
  505. $this->assertTrue(in_array('19 > 1 (translated)', $plurals));
  506. $this->assertTrue(in_array('20 > 1 (translated)', $plurals));
  507. $this->assertTrue(in_array('21 > 1 (translated)', $plurals));
  508. $this->assertTrue(in_array('22 > 1 (translated)', $plurals));
  509. $this->assertTrue(in_array('23 > 1 (translated)', $plurals));
  510. $this->assertTrue(in_array('24 > 1 (translated)', $plurals));
  511. $this->assertTrue(in_array('25 > 1 (translated)', $plurals));
  512. $coreSingular = $this->__singularFromCore();
  513. $this->assertEqual('Plural Rule 2 (from core translated)', $coreSingular);
  514. $corePlurals = $this->__pluralFromCore();
  515. $this->assertTrue(in_array('0 = 0 or 1 (from core translated)', $corePlurals));
  516. $this->assertTrue(in_array('1 = 0 or 1 (from core translated)', $corePlurals));
  517. $this->assertTrue(in_array('2 > 1 (from core translated)', $corePlurals));
  518. $this->assertTrue(in_array('3 > 1 (from core translated)', $corePlurals));
  519. $this->assertTrue(in_array('4 > 1 (from core translated)', $corePlurals));
  520. $this->assertTrue(in_array('5 > 1 (from core translated)', $corePlurals));
  521. $this->assertTrue(in_array('6 > 1 (from core translated)', $corePlurals));
  522. $this->assertTrue(in_array('7 > 1 (from core translated)', $corePlurals));
  523. $this->assertTrue(in_array('8 > 1 (from core translated)', $corePlurals));
  524. $this->assertTrue(in_array('9 > 1 (from core translated)', $corePlurals));
  525. $this->assertTrue(in_array('10 > 1 (from core translated)', $corePlurals));
  526. $this->assertTrue(in_array('11 > 1 (from core translated)', $corePlurals));
  527. $this->assertTrue(in_array('12 > 1 (from core translated)', $corePlurals));
  528. $this->assertTrue(in_array('13 > 1 (from core translated)', $corePlurals));
  529. $this->assertTrue(in_array('14 > 1 (from core translated)', $corePlurals));
  530. $this->assertTrue(in_array('15 > 1 (from core translated)', $corePlurals));
  531. $this->assertTrue(in_array('16 > 1 (from core translated)', $corePlurals));
  532. $this->assertTrue(in_array('17 > 1 (from core translated)', $corePlurals));
  533. $this->assertTrue(in_array('18 > 1 (from core translated)', $corePlurals));
  534. $this->assertTrue(in_array('19 > 1 (from core translated)', $corePlurals));
  535. $this->assertTrue(in_array('20 > 1 (from core translated)', $corePlurals));
  536. $this->assertTrue(in_array('21 > 1 (from core translated)', $corePlurals));
  537. $this->assertTrue(in_array('22 > 1 (from core translated)', $corePlurals));
  538. $this->assertTrue(in_array('23 > 1 (from core translated)', $corePlurals));
  539. $this->assertTrue(in_array('24 > 1 (from core translated)', $corePlurals));
  540. $this->assertTrue(in_array('25 > 1 (from core translated)', $corePlurals));
  541. }
  542. /**
  543. * testPoRulesThree method
  544. *
  545. * @return void
  546. */
  547. public function testPoRulesThree() {
  548. Configure::write('Config.language', 'rule_3_po');
  549. $singular = $this->__singular();
  550. $this->assertEqual('Plural Rule 3 (translated)', $singular);
  551. $plurals = $this->__plural();
  552. $this->assertTrue(in_array('0 = 0 (translated)', $plurals));
  553. $this->assertTrue(in_array('1 ends 1 but not 11 (translated)', $plurals));
  554. $this->assertTrue(in_array('2 everything else (translated)', $plurals));
  555. $this->assertTrue(in_array('3 everything else (translated)', $plurals));
  556. $this->assertTrue(in_array('4 everything else (translated)', $plurals));
  557. $this->assertTrue(in_array('5 everything else (translated)', $plurals));
  558. $this->assertTrue(in_array('6 everything else (translated)', $plurals));
  559. $this->assertTrue(in_array('7 everything else (translated)', $plurals));
  560. $this->assertTrue(in_array('8 everything else (translated)', $plurals));
  561. $this->assertTrue(in_array('9 everything else (translated)', $plurals));
  562. $this->assertTrue(in_array('10 everything else (translated)', $plurals));
  563. $this->assertTrue(in_array('11 everything else (translated)', $plurals));
  564. $this->assertTrue(in_array('12 everything else (translated)', $plurals));
  565. $this->assertTrue(in_array('13 everything else (translated)', $plurals));
  566. $this->assertTrue(in_array('14 everything else (translated)', $plurals));
  567. $this->assertTrue(in_array('15 everything else (translated)', $plurals));
  568. $this->assertTrue(in_array('16 everything else (translated)', $plurals));
  569. $this->assertTrue(in_array('17 everything else (translated)', $plurals));
  570. $this->assertTrue(in_array('18 everything else (translated)', $plurals));
  571. $this->assertTrue(in_array('19 everything else (translated)', $plurals));
  572. $this->assertTrue(in_array('20 everything else (translated)', $plurals));
  573. $this->assertTrue(in_array('21 ends 1 but not 11 (translated)', $plurals));
  574. $this->assertTrue(in_array('22 everything else (translated)', $plurals));
  575. $this->assertTrue(in_array('23 everything else (translated)', $plurals));
  576. $this->assertTrue(in_array('24 everything else (translated)', $plurals));
  577. $this->assertTrue(in_array('25 everything else (translated)', $plurals));
  578. $coreSingular = $this->__singularFromCore();
  579. $this->assertEqual('Plural Rule 3 (from core translated)', $coreSingular);
  580. $corePlurals = $this->__pluralFromCore();
  581. $this->assertTrue(in_array('0 = 0 (from core translated)', $corePlurals));
  582. $this->assertTrue(in_array('1 ends 1 but not 11 (from core translated)', $corePlurals));
  583. $this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals));
  584. $this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals));
  585. $this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals));
  586. $this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
  587. $this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
  588. $this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
  589. $this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
  590. $this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
  591. $this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
  592. $this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
  593. $this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
  594. $this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
  595. $this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
  596. $this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
  597. $this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
  598. $this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
  599. $this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
  600. $this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
  601. $this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
  602. $this->assertTrue(in_array('21 ends 1 but not 11 (from core translated)', $corePlurals));
  603. $this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
  604. $this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
  605. $this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
  606. $this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
  607. }
  608. /**
  609. * testMoRulesThree method
  610. *
  611. * @return void
  612. */
  613. public function testMoRulesThree() {
  614. Configure::write('Config.language', 'rule_3_mo');
  615. $singular = $this->__singular();
  616. $this->assertEqual('Plural Rule 3 (translated)', $singular);
  617. $plurals = $this->__plural();
  618. $this->assertTrue(in_array('0 = 0 (translated)', $plurals));
  619. $this->assertTrue(in_array('1 ends 1 but not 11 (translated)', $plurals));
  620. $this->assertTrue(in_array('2 everything else (translated)', $plurals));
  621. $this->assertTrue(in_array('3 everything else (translated)', $plurals));
  622. $this->assertTrue(in_array('4 everything else (translated)', $plurals));
  623. $this->assertTrue(in_array('5 everything else (translated)', $plurals));
  624. $this->assertTrue(in_array('6 everything else (translated)', $plurals));
  625. $this->assertTrue(in_array('7 everything else (translated)', $plurals));
  626. $this->assertTrue(in_array('8 everything else (translated)', $plurals));
  627. $this->assertTrue(in_array('9 everything else (translated)', $plurals));
  628. $this->assertTrue(in_array('10 everything else (translated)', $plurals));
  629. $this->assertTrue(in_array('11 everything else (translated)', $plurals));
  630. $this->assertTrue(in_array('12 everything else (translated)', $plurals));
  631. $this->assertTrue(in_array('13 everything else (translated)', $plurals));
  632. $this->assertTrue(in_array('14 everything else (translated)', $plurals));
  633. $this->assertTrue(in_array('15 everything else (translated)', $plurals));
  634. $this->assertTrue(in_array('16 everything else (translated)', $plurals));
  635. $this->assertTrue(in_array('17 everything else (translated)', $plurals));
  636. $this->assertTrue(in_array('18 everything else (translated)', $plurals));
  637. $this->assertTrue(in_array('19 everything else (translated)', $plurals));
  638. $this->assertTrue(in_array('20 everything else (translated)', $plurals));
  639. $this->assertTrue(in_array('21 ends 1 but not 11 (translated)', $plurals));
  640. $this->assertTrue(in_array('22 everything else (translated)', $plurals));
  641. $this->assertTrue(in_array('23 everything else (translated)', $plurals));
  642. $this->assertTrue(in_array('24 everything else (translated)', $plurals));
  643. $this->assertTrue(in_array('25 everything else (translated)', $plurals));
  644. $coreSingular = $this->__singularFromCore();
  645. $this->assertEqual('Plural Rule 3 (from core translated)', $coreSingular);
  646. $corePlurals = $this->__pluralFromCore();
  647. $this->assertTrue(in_array('0 = 0 (from core translated)', $corePlurals));
  648. $this->assertTrue(in_array('1 ends 1 but not 11 (from core translated)', $corePlurals));
  649. $this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals));
  650. $this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals));
  651. $this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals));
  652. $this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
  653. $this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
  654. $this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
  655. $this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
  656. $this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
  657. $this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
  658. $this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
  659. $this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
  660. $this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
  661. $this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
  662. $this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
  663. $this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
  664. $this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
  665. $this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
  666. $this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
  667. $this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
  668. $this->assertTrue(in_array('21 ends 1 but not 11 (from core translated)', $corePlurals));
  669. $this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
  670. $this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
  671. $this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
  672. $this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
  673. }
  674. /**
  675. * testPoRulesFour method
  676. *
  677. * @return void
  678. */
  679. public function testPoRulesFour() {
  680. Configure::write('Config.language', 'rule_4_po');
  681. $singular = $this->__singular();
  682. $this->assertEqual('Plural Rule 4 (translated)', $singular);
  683. $plurals = $this->__plural();
  684. $this->assertTrue(in_array('0 everything else (translated)', $plurals));
  685. $this->assertTrue(in_array('1 = 1 (translated)', $plurals));
  686. $this->assertTrue(in_array('2 = 2 (translated)', $plurals));
  687. $this->assertTrue(in_array('3 everything else (translated)', $plurals));
  688. $this->assertTrue(in_array('4 everything else (translated)', $plurals));
  689. $this->assertTrue(in_array('5 everything else (translated)', $plurals));
  690. $this->assertTrue(in_array('6 everything else (translated)', $plurals));
  691. $this->assertTrue(in_array('7 everything else (translated)', $plurals));
  692. $this->assertTrue(in_array('8 everything else (translated)', $plurals));
  693. $this->assertTrue(in_array('9 everything else (translated)', $plurals));
  694. $this->assertTrue(in_array('10 everything else (translated)', $plurals));
  695. $this->assertTrue(in_array('11 everything else (translated)', $plurals));
  696. $this->assertTrue(in_array('12 everything else (translated)', $plurals));
  697. $this->assertTrue(in_array('13 everything else (translated)', $plurals));
  698. $this->assertTrue(in_array('14 everything else (translated)', $plurals));
  699. $this->assertTrue(in_array('15 everything else (translated)', $plurals));
  700. $this->assertTrue(in_array('16 everything else (translated)', $plurals));
  701. $this->assertTrue(in_array('17 everything else (translated)', $plurals));
  702. $this->assertTrue(in_array('18 everything else (translated)', $plurals));
  703. $this->assertTrue(in_array('19 everything else (translated)', $plurals));
  704. $this->assertTrue(in_array('20 everything else (translated)', $plurals));
  705. $this->assertTrue(in_array('21 everything else (translated)', $plurals));
  706. $this->assertTrue(in_array('22 everything else (translated)', $plurals));
  707. $this->assertTrue(in_array('23 everything else (translated)', $plurals));
  708. $this->assertTrue(in_array('24 everything else (translated)', $plurals));
  709. $this->assertTrue(in_array('25 everything else (translated)', $plurals));
  710. $coreSingular = $this->__singularFromCore();
  711. $this->assertEqual('Plural Rule 4 (from core translated)', $coreSingular);
  712. $corePlurals = $this->__pluralFromCore();
  713. $this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
  714. $this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals));
  715. $this->assertTrue(in_array('2 = 2 (from core translated)', $corePlurals));
  716. $this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals));
  717. $this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals));
  718. $this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
  719. $this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
  720. $this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
  721. $this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
  722. $this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
  723. $this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
  724. $this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
  725. $this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
  726. $this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
  727. $this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
  728. $this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
  729. $this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
  730. $this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
  731. $this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
  732. $this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
  733. $this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
  734. $this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
  735. $this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
  736. $this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
  737. $this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
  738. $this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
  739. }
  740. /**
  741. * testMoRulesFour method
  742. *
  743. * @return void
  744. */
  745. public function testMoRulesFour() {
  746. Configure::write('Config.language', 'rule_4_mo');
  747. $singular = $this->__singular();
  748. $this->assertEqual('Plural Rule 4 (translated)', $singular);
  749. $plurals = $this->__plural();
  750. $this->assertTrue(in_array('0 everything else (translated)', $plurals));
  751. $this->assertTrue(in_array('1 = 1 (translated)', $plurals));
  752. $this->assertTrue(in_array('2 = 2 (translated)', $plurals));
  753. $this->assertTrue(in_array('3 everything else (translated)', $plurals));
  754. $this->assertTrue(in_array('4 everything else (translated)', $plurals));
  755. $this->assertTrue(in_array('5 everything else (translated)', $plurals));
  756. $this->assertTrue(in_array('6 everything else (translated)', $plurals));
  757. $this->assertTrue(in_array('7 everything else (translated)', $plurals));
  758. $this->assertTrue(in_array('8 everything else (translated)', $plurals));
  759. $this->assertTrue(in_array('9 everything else (translated)', $plurals));
  760. $this->assertTrue(in_array('10 everything else (translated)', $plurals));
  761. $this->assertTrue(in_array('11 everything else (translated)', $plurals));
  762. $this->assertTrue(in_array('12 everything else (translated)', $plurals));
  763. $this->assertTrue(in_array('13 everything else (translated)', $plurals));
  764. $this->assertTrue(in_array('14 everything else (translated)', $plurals));
  765. $this->assertTrue(in_array('15 everything else (translated)', $plurals));
  766. $this->assertTrue(in_array('16 everything else (translated)', $plurals));
  767. $this->assertTrue(in_array('17 everything else (translated)', $plurals));
  768. $this->assertTrue(in_array('18 everything else (translated)', $plurals));
  769. $this->assertTrue(in_array('19 everything else (translated)', $plurals));
  770. $this->assertTrue(in_array('20 everything else (translated)', $plurals));
  771. $this->assertTrue(in_array('21 everything else (translated)', $plurals));
  772. $this->assertTrue(in_array('22 everything else (translated)', $plurals));
  773. $this->assertTrue(in_array('23 everything else (translated)', $plurals));
  774. $this->assertTrue(in_array('24 everything else (translated)', $plurals));
  775. $this->assertTrue(in_array('25 everything else (translated)', $plurals));
  776. $coreSingular = $this->__singularFromCore();
  777. $this->assertEqual('Plural Rule 4 (from core translated)', $