Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12345 anikendra 1
<?php
2
/**
3
 * I18nTest file
4
 *
5
 * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
6
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
7
 *
8
 * Licensed under The MIT License
9
 * For full copyright and license information, please see the LICENSE.txt
10
 * Redistributions of files must retain the above copyright notice
11
 *
12
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
13
 * @link          http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
14
 * @package       Cake.Test.Case.I18n
15
 * @since         CakePHP(tm) v 1.2.0.5432
16
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
17
 */
18
 
19
App::uses('I18n', 'I18n');
20
App::uses('CakeSession', 'Model/Datasource');
21
 
22
/**
23
 * I18nTest class
24
 *
25
 * @package       Cake.Test.Case.I18n
26
 */
27
class I18nTest extends CakeTestCase {
28
 
29
/**
30
 * setUp method
31
 *
32
 * @return void
33
 */
34
	public function setUp() {
35
		parent::setUp();
36
 
37
		Cache::delete('object_map', '_cake_core_');
38
		App::build(array(
39
			'Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS),
40
			'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
41
		), App::RESET);
42
		CakePlugin::load(array('TestPlugin'));
43
	}
44
 
45
/**
46
 * tearDown method
47
 *
48
 * @return void
49
 */
50
	public function tearDown() {
51
		parent::tearDown();
52
 
53
		Cache::delete('object_map', '_cake_core_');
54
		App::build();
55
		CakePlugin::unload();
56
	}
57
 
58
/**
59
 * testTranslationCaching method
60
 *
61
 * @return void
62
 */
63
	public function testTranslationCaching() {
64
		Configure::write('Config.language', 'cache_test_po');
65
 
66
		// reset internally stored entries
67
		I18n::clear();
68
 
69
		Cache::clear(false, '_cake_core_');
70
		$lang = Configure::read('Config.language');
71
 
72
		Cache::config('_cake_core_', Cache::config('default'));
73
 
74
		// make some calls to translate using different domains
75
		$this->assertEquals('Dom 1 Foo', I18n::translate('dom1.foo', false, 'dom1'));
76
		$this->assertEquals('Dom 1 Bar', I18n::translate('dom1.bar', false, 'dom1'));
77
		$domains = I18n::domains();
78
		$this->assertEquals('Dom 1 Foo', $domains['dom1']['cache_test_po']['LC_MESSAGES']['dom1.foo']);
79
 
80
		// reset internally stored entries
81
		I18n::clear();
82
 
83
		// now only dom1 should be in cache
84
		$cachedDom1 = Cache::read('dom1_' . $lang, '_cake_core_');
85
		$this->assertEquals('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']);
86
		$this->assertEquals('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']);
87
		// dom2 not in cache
88
		$this->assertFalse(Cache::read('dom2_' . $lang, '_cake_core_'));
89
 
90
		// translate a item of dom2 (adds dom2 to cache)
91
		$this->assertEquals('Dom 2 Foo', I18n::translate('dom2.foo', false, 'dom2'));
92
 
93
		// verify dom2 was cached through manual read from cache
94
		$cachedDom2 = Cache::read('dom2_' . $lang, '_cake_core_');
95
		$this->assertEquals('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']);
96
		$this->assertEquals('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']);
97
 
98
		// modify cache entry manually to verify that dom1 entries now will be read from cache
99
		$cachedDom1['LC_MESSAGES']['dom1.foo'] = 'FOO';
100
		Cache::write('dom1_' . $lang, $cachedDom1, '_cake_core_');
101
		$this->assertEquals('FOO', I18n::translate('dom1.foo', false, 'dom1'));
102
	}
103
 
104
/**
105
 * testDefaultStrings method
106
 *
107
 * @return void
108
 */
109
	public function testDefaultStrings() {
110
		$singular = $this->_singular();
111
		$this->assertEquals('Plural Rule 1', $singular);
112
 
113
		$plurals = $this->_plural();
114
		$this->assertTrue(in_array('0 = 0 or > 1', $plurals));
115
		$this->assertTrue(in_array('1 = 1', $plurals));
116
		$this->assertTrue(in_array('2 = 0 or > 1', $plurals));
117
		$this->assertTrue(in_array('3 = 0 or > 1', $plurals));
118
		$this->assertTrue(in_array('4 = 0 or > 1', $plurals));
119
		$this->assertTrue(in_array('5 = 0 or > 1', $plurals));
120
		$this->assertTrue(in_array('6 = 0 or > 1', $plurals));
121
		$this->assertTrue(in_array('7 = 0 or > 1', $plurals));
122
		$this->assertTrue(in_array('8 = 0 or > 1', $plurals));
123
		$this->assertTrue(in_array('9 = 0 or > 1', $plurals));
124
		$this->assertTrue(in_array('10 = 0 or > 1', $plurals));
125
		$this->assertTrue(in_array('11 = 0 or > 1', $plurals));
126
		$this->assertTrue(in_array('12 = 0 or > 1', $plurals));
127
		$this->assertTrue(in_array('13 = 0 or > 1', $plurals));
128
		$this->assertTrue(in_array('14 = 0 or > 1', $plurals));
129
		$this->assertTrue(in_array('15 = 0 or > 1', $plurals));
130
		$this->assertTrue(in_array('16 = 0 or > 1', $plurals));
131
		$this->assertTrue(in_array('17 = 0 or > 1', $plurals));
132
		$this->assertTrue(in_array('18 = 0 or > 1', $plurals));
133
		$this->assertTrue(in_array('19 = 0 or > 1', $plurals));
134
		$this->assertTrue(in_array('20 = 0 or > 1', $plurals));
135
		$this->assertTrue(in_array('21 = 0 or > 1', $plurals));
136
		$this->assertTrue(in_array('22 = 0 or > 1', $plurals));
137
		$this->assertTrue(in_array('23 = 0 or > 1', $plurals));
138
		$this->assertTrue(in_array('24 = 0 or > 1', $plurals));
139
		$this->assertTrue(in_array('25 = 0 or > 1', $plurals));
140
 
141
		$coreSingular = $this->_singularFromCore();
142
		$this->assertEquals('Plural Rule 1 (from core)', $coreSingular);
143
 
144
		$corePlurals = $this->_pluralFromCore();
145
		$this->assertTrue(in_array('0 = 0 or > 1 (from core)', $corePlurals));
146
		$this->assertTrue(in_array('1 = 1 (from core)', $corePlurals));
147
		$this->assertTrue(in_array('2 = 0 or > 1 (from core)', $corePlurals));
148
		$this->assertTrue(in_array('3 = 0 or > 1 (from core)', $corePlurals));
149
		$this->assertTrue(in_array('4 = 0 or > 1 (from core)', $corePlurals));
150
		$this->assertTrue(in_array('5 = 0 or > 1 (from core)', $corePlurals));
151
		$this->assertTrue(in_array('6 = 0 or > 1 (from core)', $corePlurals));
152
		$this->assertTrue(in_array('7 = 0 or > 1 (from core)', $corePlurals));
153
		$this->assertTrue(in_array('8 = 0 or > 1 (from core)', $corePlurals));
154
		$this->assertTrue(in_array('9 = 0 or > 1 (from core)', $corePlurals));
155
		$this->assertTrue(in_array('10 = 0 or > 1 (from core)', $corePlurals));
156
		$this->assertTrue(in_array('11 = 0 or > 1 (from core)', $corePlurals));
157
		$this->assertTrue(in_array('12 = 0 or > 1 (from core)', $corePlurals));
158
		$this->assertTrue(in_array('13 = 0 or > 1 (from core)', $corePlurals));
159
		$this->assertTrue(in_array('14 = 0 or > 1 (from core)', $corePlurals));
160
		$this->assertTrue(in_array('15 = 0 or > 1 (from core)', $corePlurals));
161
		$this->assertTrue(in_array('16 = 0 or > 1 (from core)', $corePlurals));
162
		$this->assertTrue(in_array('17 = 0 or > 1 (from core)', $corePlurals));
163
		$this->assertTrue(in_array('18 = 0 or > 1 (from core)', $corePlurals));
164
		$this->assertTrue(in_array('19 = 0 or > 1 (from core)', $corePlurals));
165
		$this->assertTrue(in_array('20 = 0 or > 1 (from core)', $corePlurals));
166
		$this->assertTrue(in_array('21 = 0 or > 1 (from core)', $corePlurals));
167
		$this->assertTrue(in_array('22 = 0 or > 1 (from core)', $corePlurals));
168
		$this->assertTrue(in_array('23 = 0 or > 1 (from core)', $corePlurals));
169
		$this->assertTrue(in_array('24 = 0 or > 1 (from core)', $corePlurals));
170
		$this->assertTrue(in_array('25 = 0 or > 1 (from core)', $corePlurals));
171
	}
172
 
173
/**
174
 * testPoRulesZero method
175
 *
176
 * @return void
177
 */
178
	public function testPoRulesZero() {
179
		Configure::write('Config.language', 'rule_0_po');
180
		$this->assertRulesZero();
181
	}
182
 
183
/**
184
 * testMoRulesZero method
185
 *
186
 * @return void
187
 */
188
	public function testMoRulesZero() {
189
		Configure::write('Config.language', 'rule_0_mo');
190
		$this->assertRulesZero();
191
	}
192
 
193
/**
194
 * Assertions for rules zero.
195
 *
196
 * @return void
197
 */
198
	public function assertRulesZero() {
199
		$singular = $this->_singular();
200
		$this->assertEquals('Plural Rule 0 (translated)', $singular);
201
 
202
		$plurals = $this->_plural();
203
		$this->assertTrue(in_array('0 ends with any # (translated)', $plurals));
204
		$this->assertTrue(in_array('1 ends with any # (translated)', $plurals));
205
		$this->assertTrue(in_array('2 ends with any # (translated)', $plurals));
206
		$this->assertTrue(in_array('3 ends with any # (translated)', $plurals));
207
		$this->assertTrue(in_array('4 ends with any # (translated)', $plurals));
208
		$this->assertTrue(in_array('5 ends with any # (translated)', $plurals));
209
		$this->assertTrue(in_array('6 ends with any # (translated)', $plurals));
210
		$this->assertTrue(in_array('7 ends with any # (translated)', $plurals));
211
		$this->assertTrue(in_array('8 ends with any # (translated)', $plurals));
212
		$this->assertTrue(in_array('9 ends with any # (translated)', $plurals));
213
		$this->assertTrue(in_array('10 ends with any # (translated)', $plurals));
214
		$this->assertTrue(in_array('11 ends with any # (translated)', $plurals));
215
		$this->assertTrue(in_array('12 ends with any # (translated)', $plurals));
216
		$this->assertTrue(in_array('13 ends with any # (translated)', $plurals));
217
		$this->assertTrue(in_array('14 ends with any # (translated)', $plurals));
218
		$this->assertTrue(in_array('15 ends with any # (translated)', $plurals));
219
		$this->assertTrue(in_array('16 ends with any # (translated)', $plurals));
220
		$this->assertTrue(in_array('17 ends with any # (translated)', $plurals));
221
		$this->assertTrue(in_array('18 ends with any # (translated)', $plurals));
222
		$this->assertTrue(in_array('19 ends with any # (translated)', $plurals));
223
		$this->assertTrue(in_array('20 ends with any # (translated)', $plurals));
224
		$this->assertTrue(in_array('21 ends with any # (translated)', $plurals));
225
		$this->assertTrue(in_array('22 ends with any # (translated)', $plurals));
226
		$this->assertTrue(in_array('23 ends with any # (translated)', $plurals));
227
		$this->assertTrue(in_array('24 ends with any # (translated)', $plurals));
228
		$this->assertTrue(in_array('25 ends with any # (translated)', $plurals));
229
 
230
		$coreSingular = $this->_singularFromCore();
231
		$this->assertEquals('Plural Rule 0 (from core translated)', $coreSingular);
232
 
233
		$corePlurals = $this->_pluralFromCore();
234
		$this->assertTrue(in_array('0 ends with any # (from core translated)', $corePlurals));
235
		$this->assertTrue(in_array('1 ends with any # (from core translated)', $corePlurals));
236
		$this->assertTrue(in_array('2 ends with any # (from core translated)', $corePlurals));
237
		$this->assertTrue(in_array('3 ends with any # (from core translated)', $corePlurals));
238
		$this->assertTrue(in_array('4 ends with any # (from core translated)', $corePlurals));
239
		$this->assertTrue(in_array('5 ends with any # (from core translated)', $corePlurals));
240
		$this->assertTrue(in_array('6 ends with any # (from core translated)', $corePlurals));
241
		$this->assertTrue(in_array('7 ends with any # (from core translated)', $corePlurals));
242
		$this->assertTrue(in_array('8 ends with any # (from core translated)', $corePlurals));
243
		$this->assertTrue(in_array('9 ends with any # (from core translated)', $corePlurals));
244
		$this->assertTrue(in_array('10 ends with any # (from core translated)', $corePlurals));
245
		$this->assertTrue(in_array('11 ends with any # (from core translated)', $corePlurals));
246
		$this->assertTrue(in_array('12 ends with any # (from core translated)', $corePlurals));
247
		$this->assertTrue(in_array('13 ends with any # (from core translated)', $corePlurals));
248
		$this->assertTrue(in_array('14 ends with any # (from core translated)', $corePlurals));
249
		$this->assertTrue(in_array('15 ends with any # (from core translated)', $corePlurals));
250
		$this->assertTrue(in_array('16 ends with any # (from core translated)', $corePlurals));
251
		$this->assertTrue(in_array('17 ends with any # (from core translated)', $corePlurals));
252
		$this->assertTrue(in_array('18 ends with any # (from core translated)', $corePlurals));
253
		$this->assertTrue(in_array('19 ends with any # (from core translated)', $corePlurals));
254
		$this->assertTrue(in_array('20 ends with any # (from core translated)', $corePlurals));
255
		$this->assertTrue(in_array('21 ends with any # (from core translated)', $corePlurals));
256
		$this->assertTrue(in_array('22 ends with any # (from core translated)', $corePlurals));
257
		$this->assertTrue(in_array('23 ends with any # (from core translated)', $corePlurals));
258
		$this->assertTrue(in_array('24 ends with any # (from core translated)', $corePlurals));
259
		$this->assertTrue(in_array('25 ends with any # (from core translated)', $corePlurals));
260
	}
261
 
262
/**
263
 * testPoRulesOne method
264
 *
265
 * @return void
266
 */
267
	public function testPoRulesOne() {
268
		Configure::write('Config.language', 'rule_1_po');
269
		$this->assertRulesOne();
270
	}
271
 
272
/**
273
 * testMoRulesOne method
274
 *
275
 * @return void
276
 */
277
	public function testMoRulesOne() {
278
		Configure::write('Config.language', 'rule_1_mo');
279
		$this->assertRulesOne();
280
	}
281
 
282
/**
283
 * Assertions for plural rule one
284
 *
285
 * @return void
286
 */
287
	public function assertRulesOne() {
288
		$singular = $this->_singular();
289
		$this->assertEquals('Plural Rule 1 (translated)', $singular);
290
 
291
		$plurals = $this->_plural();
292
		$this->assertTrue(in_array('0 = 0 or > 1 (translated)', $plurals));
293
		$this->assertTrue(in_array('1 = 1 (translated)', $plurals));
294
		$this->assertTrue(in_array('2 = 0 or > 1 (translated)', $plurals));
295
		$this->assertTrue(in_array('3 = 0 or > 1 (translated)', $plurals));
296
		$this->assertTrue(in_array('4 = 0 or > 1 (translated)', $plurals));
297
		$this->assertTrue(in_array('5 = 0 or > 1 (translated)', $plurals));
298
		$this->assertTrue(in_array('6 = 0 or > 1 (translated)', $plurals));
299
		$this->assertTrue(in_array('7 = 0 or > 1 (translated)', $plurals));
300
		$this->assertTrue(in_array('8 = 0 or > 1 (translated)', $plurals));
301
		$this->assertTrue(in_array('9 = 0 or > 1 (translated)', $plurals));
302
		$this->assertTrue(in_array('10 = 0 or > 1 (translated)', $plurals));
303
		$this->assertTrue(in_array('11 = 0 or > 1 (translated)', $plurals));
304
		$this->assertTrue(in_array('12 = 0 or > 1 (translated)', $plurals));
305
		$this->assertTrue(in_array('13 = 0 or > 1 (translated)', $plurals));
306
		$this->assertTrue(in_array('14 = 0 or > 1 (translated)', $plurals));
307
		$this->assertTrue(in_array('15 = 0 or > 1 (translated)', $plurals));
308
		$this->assertTrue(in_array('16 = 0 or > 1 (translated)', $plurals));
309
		$this->assertTrue(in_array('17 = 0 or > 1 (translated)', $plurals));
310
		$this->assertTrue(in_array('18 = 0 or > 1 (translated)', $plurals));
311
		$this->assertTrue(in_array('19 = 0 or > 1 (translated)', $plurals));
312
		$this->assertTrue(in_array('20 = 0 or > 1 (translated)', $plurals));
313
		$this->assertTrue(in_array('21 = 0 or > 1 (translated)', $plurals));
314
		$this->assertTrue(in_array('22 = 0 or > 1 (translated)', $plurals));
315
		$this->assertTrue(in_array('23 = 0 or > 1 (translated)', $plurals));
316
		$this->assertTrue(in_array('24 = 0 or > 1 (translated)', $plurals));
317
		$this->assertTrue(in_array('25 = 0 or > 1 (translated)', $plurals));
318
 
319
		$coreSingular = $this->_singularFromCore();
320
		$this->assertEquals('Plural Rule 1 (from core translated)', $coreSingular);
321
 
322
		$corePlurals = $this->_pluralFromCore();
323
		$this->assertTrue(in_array('0 = 0 or > 1 (from core translated)', $corePlurals));
324
		$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals));
325
		$this->assertTrue(in_array('2 = 0 or > 1 (from core translated)', $corePlurals));
326
		$this->assertTrue(in_array('3 = 0 or > 1 (from core translated)', $corePlurals));
327
		$this->assertTrue(in_array('4 = 0 or > 1 (from core translated)', $corePlurals));
328
		$this->assertTrue(in_array('5 = 0 or > 1 (from core translated)', $corePlurals));
329
		$this->assertTrue(in_array('6 = 0 or > 1 (from core translated)', $corePlurals));
330
		$this->assertTrue(in_array('7 = 0 or > 1 (from core translated)', $corePlurals));
331
		$this->assertTrue(in_array('8 = 0 or > 1 (from core translated)', $corePlurals));
332
		$this->assertTrue(in_array('9 = 0 or > 1 (from core translated)', $corePlurals));
333
		$this->assertTrue(in_array('10 = 0 or > 1 (from core translated)', $corePlurals));
334
		$this->assertTrue(in_array('11 = 0 or > 1 (from core translated)', $corePlurals));
335
		$this->assertTrue(in_array('12 = 0 or > 1 (from core translated)', $corePlurals));
336
		$this->assertTrue(in_array('13 = 0 or > 1 (from core translated)', $corePlurals));
337
		$this->assertTrue(in_array('14 = 0 or > 1 (from core translated)', $corePlurals));
338
		$this->assertTrue(in_array('15 = 0 or > 1 (from core translated)', $corePlurals));
339
		$this->assertTrue(in_array('16 = 0 or > 1 (from core translated)', $corePlurals));
340
		$this->assertTrue(in_array('17 = 0 or > 1 (from core translated)', $corePlurals));
341
		$this->assertTrue(in_array('18 = 0 or > 1 (from core translated)', $corePlurals));
342
		$this->assertTrue(in_array('19 = 0 or > 1 (from core translated)', $corePlurals));
343
		$this->assertTrue(in_array('20 = 0 or > 1 (from core translated)', $corePlurals));
344
		$this->assertTrue(in_array('21 = 0 or > 1 (from core translated)', $corePlurals));
345
		$this->assertTrue(in_array('22 = 0 or > 1 (from core translated)', $corePlurals));
346
		$this->assertTrue(in_array('23 = 0 or > 1 (from core translated)', $corePlurals));
347
		$this->assertTrue(in_array('24 = 0 or > 1 (from core translated)', $corePlurals));
348
		$this->assertTrue(in_array('25 = 0 or > 1 (from core translated)', $corePlurals));
349
	}
350
 
351
/**
352
 * testMoRulesTwo method
353
 *
354
 * @return void
355
 */
356
	public function testMoRulesTwo() {
357
		Configure::write('Config.language', 'rule_2_mo');
358
		$this->assertRulesTwo();
359
	}
360
 
361
/**
362
 * testPoRulesTwo method
363
 *
364
 * @return void
365
 */
366
	public function testPoRulesTwo() {
367
		Configure::write('Config.language', 'rule_2_po');
368
		$this->assertRulesTwo();
369
	}
370
 
371
/**
372
 * Assertions for rules Two
373
 *
374
 * @return void
375
 */
376
	public function assertRulesTwo() {
377
		$singular = $this->_singular();
378
		$this->assertEquals('Plural Rule 2 (translated)', $singular);
379
 
380
		$plurals = $this->_plural();
381
		$this->assertTrue(in_array('0 = 0 or 1 (translated)', $plurals));
382
		$this->assertTrue(in_array('1 = 0 or 1 (translated)', $plurals));
383
		$this->assertTrue(in_array('2 > 1 (translated)', $plurals));
384
		$this->assertTrue(in_array('3 > 1 (translated)', $plurals));
385
		$this->assertTrue(in_array('4 > 1 (translated)', $plurals));
386
		$this->assertTrue(in_array('5 > 1 (translated)', $plurals));
387
		$this->assertTrue(in_array('6 > 1 (translated)', $plurals));
388
		$this->assertTrue(in_array('7 > 1 (translated)', $plurals));
389
		$this->assertTrue(in_array('8 > 1 (translated)', $plurals));
390
		$this->assertTrue(in_array('9 > 1 (translated)', $plurals));
391
		$this->assertTrue(in_array('10 > 1 (translated)', $plurals));
392
		$this->assertTrue(in_array('11 > 1 (translated)', $plurals));
393
		$this->assertTrue(in_array('12 > 1 (translated)', $plurals));
394
		$this->assertTrue(in_array('13 > 1 (translated)', $plurals));
395
		$this->assertTrue(in_array('14 > 1 (translated)', $plurals));
396
		$this->assertTrue(in_array('15 > 1 (translated)', $plurals));
397
		$this->assertTrue(in_array('16 > 1 (translated)', $plurals));
398
		$this->assertTrue(in_array('17 > 1 (translated)', $plurals));
399
		$this->assertTrue(in_array('18 > 1 (translated)', $plurals));
400
		$this->assertTrue(in_array('19 > 1 (translated)', $plurals));
401
		$this->assertTrue(in_array('20 > 1 (translated)', $plurals));
402
		$this->assertTrue(in_array('21 > 1 (translated)', $plurals));
403
		$this->assertTrue(in_array('22 > 1 (translated)', $plurals));
404
		$this->assertTrue(in_array('23 > 1 (translated)', $plurals));
405
		$this->assertTrue(in_array('24 > 1 (translated)', $plurals));
406
		$this->assertTrue(in_array('25 > 1 (translated)', $plurals));
407
 
408
		$coreSingular = $this->_singularFromCore();
409
		$this->assertEquals('Plural Rule 2 (from core translated)', $coreSingular);
410
 
411
		$corePlurals = $this->_pluralFromCore();
412
		$this->assertTrue(in_array('0 = 0 or 1 (from core translated)', $corePlurals));
413
		$this->assertTrue(in_array('1 = 0 or 1 (from core translated)', $corePlurals));
414
		$this->assertTrue(in_array('2 > 1 (from core translated)', $corePlurals));
415
		$this->assertTrue(in_array('3 > 1 (from core translated)', $corePlurals));
416
		$this->assertTrue(in_array('4 > 1 (from core translated)', $corePlurals));
417
		$this->assertTrue(in_array('5 > 1 (from core translated)', $corePlurals));
418
		$this->assertTrue(in_array('6 > 1 (from core translated)', $corePlurals));
419
		$this->assertTrue(in_array('7 > 1 (from core translated)', $corePlurals));
420
		$this->assertTrue(in_array('8 > 1 (from core translated)', $corePlurals));
421
		$this->assertTrue(in_array('9 > 1 (from core translated)', $corePlurals));
422
		$this->assertTrue(in_array('10 > 1 (from core translated)', $corePlurals));
423
		$this->assertTrue(in_array('11 > 1 (from core translated)', $corePlurals));
424
		$this->assertTrue(in_array('12 > 1 (from core translated)', $corePlurals));
425
		$this->assertTrue(in_array('13 > 1 (from core translated)', $corePlurals));
426
		$this->assertTrue(in_array('14 > 1 (from core translated)', $corePlurals));
427
		$this->assertTrue(in_array('15 > 1 (from core translated)', $corePlurals));
428
		$this->assertTrue(in_array('16 > 1 (from core translated)', $corePlurals));
429
		$this->assertTrue(in_array('17 > 1 (from core translated)', $corePlurals));
430
		$this->assertTrue(in_array('18 > 1 (from core translated)', $corePlurals));
431
		$this->assertTrue(in_array('19 > 1 (from core translated)', $corePlurals));
432
		$this->assertTrue(in_array('20 > 1 (from core translated)', $corePlurals));
433
		$this->assertTrue(in_array('21 > 1 (from core translated)', $corePlurals));
434
		$this->assertTrue(in_array('22 > 1 (from core translated)', $corePlurals));
435
		$this->assertTrue(in_array('23 > 1 (from core translated)', $corePlurals));
436
		$this->assertTrue(in_array('24 > 1 (from core translated)', $corePlurals));
437
		$this->assertTrue(in_array('25 > 1 (from core translated)', $corePlurals));
438
	}
439
 
440
/**
441
 * testPoRulesThree method
442
 *
443
 * @return void
444
 */
445
	public function testPoRulesThree() {
446
		Configure::write('Config.language', 'rule_3_po');
447
		$this->assertRulesThree();
448
	}
449
 
450
/**
451
 * testMoRulesThree method
452
 *
453
 * @return void
454
 */
455
	public function testMoRulesThree() {
456
		Configure::write('Config.language', 'rule_3_mo');
457
		$this->assertRulesThree();
458
	}
459
 
460
/**
461
 * Assert rules for plural three.
462
 *
463
 * @return void
464
 */
465
	public function assertRulesThree() {
466
		$singular = $this->_singular();
467
		$this->assertEquals('Plural Rule 3 (translated)', $singular);
468
 
469
		$plurals = $this->_plural();
470
		$this->assertTrue(in_array('0 = 0 (translated)', $plurals));
471
		$this->assertTrue(in_array('1 ends 1 but not 11 (translated)', $plurals));
472
		$this->assertTrue(in_array('2 everything else (translated)', $plurals));
473
		$this->assertTrue(in_array('3 everything else (translated)', $plurals));
474
		$this->assertTrue(in_array('4 everything else (translated)', $plurals));
475
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
476
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
477
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
478
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
479
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
480
		$this->assertTrue(in_array('10 everything else (translated)', $plurals));
481
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
482
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
483
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
484
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
485
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
486
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
487
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
488
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
489
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
490
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
491
		$this->assertTrue(in_array('21 ends 1 but not 11 (translated)', $plurals));
492
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
493
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
494
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
495
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
496
 
497
		$coreSingular = $this->_singularFromCore();
498
		$this->assertEquals('Plural Rule 3 (from core translated)', $coreSingular);
499
 
500
		$corePlurals = $this->_pluralFromCore();
501
		$this->assertTrue(in_array('0 = 0 (from core translated)', $corePlurals));
502
		$this->assertTrue(in_array('1 ends 1 but not 11 (from core translated)', $corePlurals));
503
		$this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals));
504
		$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals));
505
		$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals));
506
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
507
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
508
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
509
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
510
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
511
		$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
512
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
513
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
514
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
515
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
516
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
517
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
518
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
519
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
520
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
521
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
522
		$this->assertTrue(in_array('21 ends 1 but not 11 (from core translated)', $corePlurals));
523
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
524
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
525
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
526
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
527
	}
528
 
529
/**
530
 * testPoRulesFour method
531
 *
532
 * @return void
533
 */
534
	public function testPoRulesFour() {
535
		Configure::write('Config.language', 'rule_4_po');
536
		$this->assertRulesFour();
537
	}
538
 
539
/**
540
 * testMoRulesFour method
541
 *
542
 * @return void
543
 */
544
	public function testMoRulesFour() {
545
		Configure::write('Config.language', 'rule_4_mo');
546
		$this->assertRulesFour();
547
	}
548
 
549
/**
550
 * Run the assertions for Rule 4 plurals.
551
 *
552
 * @return void
553
 */
554
	public function assertRulesFour() {
555
		$singular = $this->_singular();
556
		$this->assertEquals('Plural Rule 4 (translated)', $singular);
557
 
558
		$plurals = $this->_plural();
559
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
560
		$this->assertTrue(in_array('1 = 1 (translated)', $plurals));
561
		$this->assertTrue(in_array('2 = 2 (translated)', $plurals));
562
		$this->assertTrue(in_array('3 everything else (translated)', $plurals));
563
		$this->assertTrue(in_array('4 everything else (translated)', $plurals));
564
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
565
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
566
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
567
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
568
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
569
		$this->assertTrue(in_array('10 everything else (translated)', $plurals));
570
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
571
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
572
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
573
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
574
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
575
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
576
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
577
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
578
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
579
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
580
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
581
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
582
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
583
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
584
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
585
 
586
		$coreSingular = $this->_singularFromCore();
587
		$this->assertEquals('Plural Rule 4 (from core translated)', $coreSingular);
588
 
589
		$corePlurals = $this->_pluralFromCore();
590
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
591
		$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals));
592
		$this->assertTrue(in_array('2 = 2 (from core translated)', $corePlurals));
593
		$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals));
594
		$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals));
595
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
596
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
597
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
598
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
599
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
600
		$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
601
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
602
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
603
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
604
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
605
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
606
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
607
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
608
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
609
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
610
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
611
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
612
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
613
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
614
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
615
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
616
	}
617
 
618
/**
619
 * testPoRulesFive method
620
 *
621
 * @return void
622
 */
623
	public function testPoRulesFive() {
624
		Configure::write('Config.language', 'rule_5_po');
625
		$this->assertRulesFive();
626
	}
627
 
628
/**
629
 * testMoRulesFive method
630
 *
631
 * @return void
632
 */
633
	public function testMoRulesFive() {
634
		Configure::write('Config.language', 'rule_5_mo');
635
		$this->assertRulesFive();
636
	}
637
 
638
/**
639
 * Run the assertions for rule 5 plurals
640
 *
641
 * @return void
642
 */
643
	public function assertRulesFive() {
644
		$singular = $this->_singular();
645
		$this->assertEquals('Plural Rule 5 (translated)', $singular);
646
 
647
		$plurals = $this->_plural();
648
		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (translated)', $plurals));
649
		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (translated)', $plurals));
650
		$this->assertTrue(in_array('1 = 1 (translated)', $plurals));
651
		$this->assertTrue(in_array('2 = 0 or ends in 01-19 (translated)', $plurals));
652
		$this->assertTrue(in_array('3 = 0 or ends in 01-19 (translated)', $plurals));
653
		$this->assertTrue(in_array('4 = 0 or ends in 01-19 (translated)', $plurals));
654
		$this->assertTrue(in_array('5 = 0 or ends in 01-19 (translated)', $plurals));
655
		$this->assertTrue(in_array('6 = 0 or ends in 01-19 (translated)', $plurals));
656
		$this->assertTrue(in_array('7 = 0 or ends in 01-19 (translated)', $plurals));
657
		$this->assertTrue(in_array('8 = 0 or ends in 01-19 (translated)', $plurals));
658
		$this->assertTrue(in_array('9 = 0 or ends in 01-19 (translated)', $plurals));
659
		$this->assertTrue(in_array('10 = 0 or ends in 01-19 (translated)', $plurals));
660
		$this->assertTrue(in_array('11 = 0 or ends in 01-19 (translated)', $plurals));
661
		$this->assertTrue(in_array('12 = 0 or ends in 01-19 (translated)', $plurals));
662
		$this->assertTrue(in_array('13 = 0 or ends in 01-19 (translated)', $plurals));
663
		$this->assertTrue(in_array('14 = 0 or ends in 01-19 (translated)', $plurals));
664
		$this->assertTrue(in_array('15 = 0 or ends in 01-19 (translated)', $plurals));
665
		$this->assertTrue(in_array('16 = 0 or ends in 01-19 (translated)', $plurals));
666
		$this->assertTrue(in_array('17 = 0 or ends in 01-19 (translated)', $plurals));
667
		$this->assertTrue(in_array('18 = 0 or ends in 01-19 (translated)', $plurals));
668
		$this->assertTrue(in_array('19 = 0 or ends in 01-19 (translated)', $plurals));
669
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
670
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
671
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
672
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
673
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
674
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
675
 
676
		$coreSingular = $this->_singularFromCore();
677
		$this->assertEquals('Plural Rule 5 (from core translated)', $coreSingular);
678
 
679
		$corePlurals = $this->_pluralFromCore();
680
		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (from core translated)', $corePlurals));
681
		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (from core translated)', $corePlurals));
682
		$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals));
683
		$this->assertTrue(in_array('2 = 0 or ends in 01-19 (from core translated)', $corePlurals));
684
		$this->assertTrue(in_array('3 = 0 or ends in 01-19 (from core translated)', $corePlurals));
685
		$this->assertTrue(in_array('4 = 0 or ends in 01-19 (from core translated)', $corePlurals));
686
		$this->assertTrue(in_array('5 = 0 or ends in 01-19 (from core translated)', $corePlurals));
687
		$this->assertTrue(in_array('6 = 0 or ends in 01-19 (from core translated)', $corePlurals));
688
		$this->assertTrue(in_array('7 = 0 or ends in 01-19 (from core translated)', $corePlurals));
689
		$this->assertTrue(in_array('8 = 0 or ends in 01-19 (from core translated)', $corePlurals));
690
		$this->assertTrue(in_array('9 = 0 or ends in 01-19 (from core translated)', $corePlurals));
691
		$this->assertTrue(in_array('10 = 0 or ends in 01-19 (from core translated)', $corePlurals));
692
		$this->assertTrue(in_array('11 = 0 or ends in 01-19 (from core translated)', $corePlurals));
693
		$this->assertTrue(in_array('12 = 0 or ends in 01-19 (from core translated)', $corePlurals));
694
		$this->assertTrue(in_array('13 = 0 or ends in 01-19 (from core translated)', $corePlurals));
695
		$this->assertTrue(in_array('14 = 0 or ends in 01-19 (from core translated)', $corePlurals));
696
		$this->assertTrue(in_array('15 = 0 or ends in 01-19 (from core translated)', $corePlurals));
697
		$this->assertTrue(in_array('16 = 0 or ends in 01-19 (from core translated)', $corePlurals));
698
		$this->assertTrue(in_array('17 = 0 or ends in 01-19 (from core translated)', $corePlurals));
699
		$this->assertTrue(in_array('18 = 0 or ends in 01-19 (from core translated)', $corePlurals));
700
		$this->assertTrue(in_array('19 = 0 or ends in 01-19 (from core translated)', $corePlurals));
701
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
702
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
703
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
704
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
705
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
706
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
707
	}
708
 
709
/**
710
 * testPoRulesSix method
711
 *
712
 * @return void
713
 */
714
	public function testPoRulesSix() {
715
		Configure::write('Config.language', 'rule_6_po');
716
		$this->assertRulesSix();
717
	}
718
 
719
/**
720
 * testMoRulesSix method
721
 *
722
 * @return void
723
 */
724
	public function testMoRulesSix() {
725
		Configure::write('Config.language', 'rule_6_mo');
726
		$this->assertRulesSix();
727
	}
728
 
729
/**
730
 * Assertions for the sixth plural rules.
731
 *
732
 * @return void
733
 */
734
	public function assertRulesSix() {
735
		$singular = $this->_singular();
736
		$this->assertEquals('Plural Rule 6 (translated)', $singular);
737
 
738
		$plurals = $this->_plural();
739
		$this->assertTrue(in_array('0 ends in 0 or ends in 10-20 (translated)', $plurals));
740
		$this->assertTrue(in_array('1 ends in 1, not 11 (translated)', $plurals));
741
		$this->assertTrue(in_array('2 everything else (translated)', $plurals));
742
		$this->assertTrue(in_array('3 everything else (translated)', $plurals));
743
		$this->assertTrue(in_array('4 everything else (translated)', $plurals));
744
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
745
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
746
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
747
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
748
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
749
		$this->assertTrue(in_array('10 ends in 0 or ends in 10-20 (translated)', $plurals));
750
		$this->assertTrue(in_array('11 ends in 0 or ends in 10-20 (translated)', $plurals));
751
		$this->assertTrue(in_array('12 ends in 0 or ends in 10-20 (translated)', $plurals));
752
		$this->assertTrue(in_array('13 ends in 0 or ends in 10-20 (translated)', $plurals));
753
		$this->assertTrue(in_array('14 ends in 0 or ends in 10-20 (translated)', $plurals));
754
		$this->assertTrue(in_array('15 ends in 0 or ends in 10-20 (translated)', $plurals));
755
		$this->assertTrue(in_array('16 ends in 0 or ends in 10-20 (translated)', $plurals));
756
		$this->assertTrue(in_array('17 ends in 0 or ends in 10-20 (translated)', $plurals));
757
		$this->assertTrue(in_array('18 ends in 0 or ends in 10-20 (translated)', $plurals));
758
		$this->assertTrue(in_array('19 ends in 0 or ends in 10-20 (translated)', $plurals));
759
		$this->assertTrue(in_array('20 ends in 0 or ends in 10-20 (translated)', $plurals));
760
		$this->assertTrue(in_array('21 ends in 1, not 11 (translated)', $plurals));
761
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
762
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
763
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
764
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
765
 
766
		$coreSingular = $this->_singularFromCore();
767
		$this->assertEquals('Plural Rule 6 (from core translated)', $coreSingular);
768
 
769
		$corePlurals = $this->_pluralFromCore();
770
		$this->assertTrue(in_array('0 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
771
		$this->assertTrue(in_array('1 ends in 1, not 11 (from core translated)', $corePlurals));
772
		$this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals));
773
		$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals));
774
		$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals));
775
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
776
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
777
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
778
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
779
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
780
		$this->assertTrue(in_array('10 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
781
		$this->assertTrue(in_array('11 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
782
		$this->assertTrue(in_array('12 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
783
		$this->assertTrue(in_array('13 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
784
		$this->assertTrue(in_array('14 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
785
		$this->assertTrue(in_array('15 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
786
		$this->assertTrue(in_array('16 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
787
		$this->assertTrue(in_array('17 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
788
		$this->assertTrue(in_array('18 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
789
		$this->assertTrue(in_array('19 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
790
		$this->assertTrue(in_array('20 ends in 0 or ends in 10-20 (from core translated)', $corePlurals));
791
		$this->assertTrue(in_array('21 ends in 1, not 11 (from core translated)', $corePlurals));
792
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
793
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
794
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
795
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
796
	}
797
 
798
/**
799
 * testPoRulesSeven method
800
 *
801
 * @return void
802
 */
803
	public function testPoRulesSeven() {
804
		Configure::write('Config.language', 'rule_7_po');
805
		$this->assertRulesSeven();
806
	}
807
 
808
/**
809
 * testMoRulesSeven method
810
 *
811
 * @return void
812
 */
813
	public function testMoRulesSeven() {
814
		Configure::write('Config.language', 'rule_7_mo');
815
		$this->assertRulesSeven();
816
	}
817
 
818
/**
819
 * Run assertions for seventh plural rules
820
 *
821
 * @return void
822
 */
823
	public function assertRulesSeven() {
824
		$singular = $this->_singular();
825
		$this->assertEquals('Plural Rule 7 (translated)', $singular);
826
 
827
		$plurals = $this->_plural();
828
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
829
		$this->assertTrue(in_array('1 ends in 1, not 11 (translated)', $plurals));
830
		$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (translated)', $plurals));
831
		$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (translated)', $plurals));
832
		$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (translated)', $plurals));
833
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
834
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
835
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
836
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
837
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
838
		$this->assertTrue(in_array('10 everything else (translated)', $plurals));
839
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
840
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
841
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
842
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
843
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
844
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
845
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
846
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
847
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
848
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
849
		$this->assertTrue(in_array('21 ends in 1, not 11 (translated)', $plurals));
850
		$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (translated)', $plurals));
851
		$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (translated)', $plurals));
852
		$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (translated)', $plurals));
853
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
854
 
855
		$coreSingular = $this->_singularFromCore();
856
		$this->assertEquals('Plural Rule 7 (from core translated)', $coreSingular);
857
 
858
		$corePlurals = $this->_pluralFromCore();
859
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
860
		$this->assertTrue(in_array('1 ends in 1, not 11 (from core translated)', $corePlurals));
861
		$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
862
		$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
863
		$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
864
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
865
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
866
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
867
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
868
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
869
		$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
870
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
871
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
872
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
873
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
874
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
875
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
876
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
877
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
878
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
879
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
880
		$this->assertTrue(in_array('21 ends in 1, not 11 (from core translated)', $corePlurals));
881
		$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
882
		$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
883
		$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
884
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
885
	}
886
 
887
/**
888
 * testPoRulesEight method
889
 *
890
 * @return void
891
 */
892
	public function testPoRulesEight() {
893
		Configure::write('Config.language', 'rule_8_po');
894
		$this->assertRulesEight();
895
	}
896
 
897
/**
898
 * testMoRulesEight method
899
 *
900
 * @return void
901
 */
902
	public function testMoRulesEight() {
903
		Configure::write('Config.language', 'rule_8_mo');
904
		$this->assertRulesEight();
905
	}
906
 
907
/**
908
 * Run assertions for the eighth plural rule.
909
 *
910
 * @return void
911
 */
912
	public function assertRulesEight() {
913
		$singular = $this->_singular();
914
		$this->assertEquals('Plural Rule 8 (translated)', $singular);
915
 
916
		$plurals = $this->_plural();
917
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
918
		$this->assertTrue(in_array('1 is 1 (translated)', $plurals));
919
		$this->assertTrue(in_array('2 is 2-4 (translated)', $plurals));
920
		$this->assertTrue(in_array('3 is 2-4 (translated)', $plurals));
921
		$this->assertTrue(in_array('4 is 2-4 (translated)', $plurals));
922
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
923
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
924
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
925
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
926
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
927
		$this->assertTrue(in_array('10 everything else (translated)', $plurals));
928
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
929
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
930
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
931
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
932
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
933
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
934
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
935
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
936
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
937
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
938
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
939
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
940
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
941
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
942
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
943
 
944
		$coreSingular = $this->_singularFromCore();
945
		$this->assertEquals('Plural Rule 8 (from core translated)', $coreSingular);
946
 
947
		$corePlurals = $this->_pluralFromCore();
948
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
949
		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals));
950
		$this->assertTrue(in_array('2 is 2-4 (from core translated)', $corePlurals));
951
		$this->assertTrue(in_array('3 is 2-4 (from core translated)', $corePlurals));
952
		$this->assertTrue(in_array('4 is 2-4 (from core translated)', $corePlurals));
953
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
954
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
955
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
956
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
957
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
958
		$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
959
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
960
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
961
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
962
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
963
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
964
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
965
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
966
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
967
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
968
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
969
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
970
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
971
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
972
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
973
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
974
	}
975
 
976
/**
977
 * testPoRulesNine method
978
 *
979
 * @return void
980
 */
981
	public function testPoRulesNine() {
982
		Configure::write('Config.language', 'rule_9_po');
983
		$this->assertRulesNine();
984
	}
985
 
986
/**
987
 * testMoRulesNine method
988
 *
989
 * @return void
990
 */
991
	public function testMoRulesNine() {
992
		Configure::write('Config.language', 'rule_9_mo');
993
		$this->assertRulesNine();
994
	}
995
 
996
/**
997
 * Assert plural rules nine
998
 *
999
 * @return void
1000
 */
1001
	public function assertRulesNine() {
1002
		$singular = $this->_singular();
1003
		$this->assertEquals('Plural Rule 9 (translated)', $singular);
1004
 
1005
		$plurals = $this->_plural();
1006
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
1007
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
1008
		$this->assertTrue(in_array('1 is 1 (translated)', $plurals));
1009
		$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (translated)', $plurals));
1010
		$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (translated)', $plurals));
1011
		$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (translated)', $plurals));
1012
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
1013
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
1014
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
1015
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
1016
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
1017
		$this->assertTrue(in_array('10 everything else (translated)', $plurals));
1018
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
1019
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
1020
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
1021
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
1022
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
1023
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
1024
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
1025
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
1026
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
1027
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
1028
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
1029
		$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (translated)', $plurals));
1030
		$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (translated)', $plurals));
1031
		$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (translated)', $plurals));
1032
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
1033
 
1034
		$coreSingular = $this->_singularFromCore();
1035
		$this->assertEquals('Plural Rule 9 (from core translated)', $coreSingular);
1036
 
1037
		$corePlurals = $this->_pluralFromCore();
1038
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
1039
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
1040
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
1041
		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals));
1042
		$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
1043
		$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
1044
		$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
1045
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
1046
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
1047
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
1048
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
1049
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
1050
		$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
1051
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
1052
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
1053
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
1054
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
1055
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
1056
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
1057
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
1058
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
1059
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
1060
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
1061
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
1062
		$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
1063
		$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
1064
		$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (from core translated)', $corePlurals));
1065
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
1066
	}
1067
 
1068
/**
1069
 * testPoRulesTen method
1070
 *
1071
 * @return void
1072
 */
1073
	public function testPoRulesTen() {
1074
		Configure::write('Config.language', 'rule_10_po');
1075
		$this->assertRulesTen();
1076
	}
1077
 
1078
/**
1079
 * testMoRulesTen method
1080
 *
1081
 * @return void
1082
 */
1083
	public function testMoRulesTen() {
1084
		Configure::write('Config.language', 'rule_10_mo');
1085
		$this->assertRulesTen();
1086
	}
1087
 
1088
/**
1089
 * Assertions for plural rules 10
1090
 *
1091
 * @return void
1092
 */
1093
	public function assertRulesTen() {
1094
		$singular = $this->_singular();
1095
		$this->assertEquals('Plural Rule 10 (translated)', $singular);
1096
 
1097
		$plurals = $this->_plural();
1098
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
1099
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
1100
		$this->assertTrue(in_array('1 ends in 1 (translated)', $plurals));
1101
		$this->assertTrue(in_array('2 ends in 2 (translated)', $plurals));
1102
		$this->assertTrue(in_array('3 ends in 03-04 (translated)', $plurals));
1103
		$this->assertTrue(in_array('4 ends in 03-04 (translated)', $plurals));
1104
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
1105
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
1106
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
1107
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
1108
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
1109
		$this->assertTrue(in_array('10 everything else (translated)', $plurals));
1110
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
1111
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
1112
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
1113
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
1114
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
1115
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
1116
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
1117
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
1118
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
1119
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
1120
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
1121
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
1122
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
1123
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
1124
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
1125
 
1126
		$coreSingular = $this->_singularFromCore();
1127
		$this->assertEquals('Plural Rule 10 (from core translated)', $coreSingular);
1128
 
1129
		$corePlurals = $this->_pluralFromCore();
1130
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
1131
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
1132
		$this->assertTrue(in_array('1 ends in 1 (from core translated)', $corePlurals));
1133
		$this->assertTrue(in_array('2 ends in 2 (from core translated)', $corePlurals));
1134
		$this->assertTrue(in_array('3 ends in 03-04 (from core translated)', $corePlurals));
1135
		$this->assertTrue(in_array('4 ends in 03-04 (from core translated)', $corePlurals));
1136
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
1137
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
1138
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
1139
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
1140
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
1141
		$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
1142
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
1143
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
1144
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
1145
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
1146
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
1147
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
1148
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
1149
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
1150
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
1151
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
1152
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
1153
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
1154
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
1155
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
1156
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
1157
	}
1158
 
1159
/**
1160
 * testPoRulesEleven method
1161
 *
1162
 * @return void
1163
 */
1164
	public function testPoRulesEleven() {
1165
		Configure::write('Config.language', 'rule_11_po');
1166
		$this->assertRulesEleven();
1167
	}
1168
 
1169
/**
1170
 * testMoRulesEleven method
1171
 *
1172
 * @return void
1173
 */
1174
	public function testMoRulesEleven() {
1175
		Configure::write('Config.language', 'rule_11_mo');
1176
		$this->assertRulesEleven();
1177
	}
1178
 
1179
/**
1180
 * Assertions for plural rules eleven
1181
 *
1182
 * @return void
1183
 */
1184
	public function assertRulesEleven() {
1185
		$singular = $this->_singular();
1186
		$this->assertEquals('Plural Rule 11 (translated)', $singular);
1187
 
1188
		$plurals = $this->_plural();
1189
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
1190
		$this->assertTrue(in_array('1 is 1 (translated)', $plurals));
1191
		$this->assertTrue(in_array('2 is 2 (translated)', $plurals));
1192
		$this->assertTrue(in_array('3 is 3-6 (translated)', $plurals));
1193
		$this->assertTrue(in_array('4 is 3-6 (translated)', $plurals));
1194
		$this->assertTrue(in_array('5 is 3-6 (translated)', $plurals));
1195
		$this->assertTrue(in_array('6 is 3-6 (translated)', $plurals));
1196
		$this->assertTrue(in_array('7 is 7-10 (translated)', $plurals));
1197
		$this->assertTrue(in_array('8 is 7-10 (translated)', $plurals));
1198
		$this->assertTrue(in_array('9 is 7-10 (translated)', $plurals));
1199
		$this->assertTrue(in_array('10 is 7-10 (translated)', $plurals));
1200
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
1201
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
1202
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
1203
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
1204
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
1205
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
1206
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
1207
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
1208
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
1209
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
1210
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
1211
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
1212
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
1213
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
1214
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
1215
 
1216
		$coreSingular = $this->_singularFromCore();
1217
		$this->assertEquals('Plural Rule 11 (from core translated)', $coreSingular);
1218
 
1219
		$corePlurals = $this->_pluralFromCore();
1220
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
1221
		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals));
1222
		$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals));
1223
		$this->assertTrue(in_array('3 is 3-6 (from core translated)', $corePlurals));
1224
		$this->assertTrue(in_array('4 is 3-6 (from core translated)', $corePlurals));
1225
		$this->assertTrue(in_array('5 is 3-6 (from core translated)', $corePlurals));
1226
		$this->assertTrue(in_array('6 is 3-6 (from core translated)', $corePlurals));
1227
		$this->assertTrue(in_array('7 is 7-10 (from core translated)', $corePlurals));
1228
		$this->assertTrue(in_array('8 is 7-10 (from core translated)', $corePlurals));
1229
		$this->assertTrue(in_array('9 is 7-10 (from core translated)', $corePlurals));
1230
		$this->assertTrue(in_array('10 is 7-10 (from core translated)', $corePlurals));
1231
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
1232
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
1233
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
1234
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
1235
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
1236
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
1237
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
1238
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
1239
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
1240
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
1241
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
1242
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
1243
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
1244
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
1245
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
1246
	}
1247
 
1248
/**
1249
 * testPoRulesTwelve method
1250
 *
1251
 * @return void
1252
 */
1253
	public function testPoRulesTwelve() {
1254
		Configure::write('Config.language', 'rule_12_po');
1255
		$this->assertRulesTwelve();
1256
	}
1257
 
1258
/**
1259
 * testMoRulesTwelve method
1260
 *
1261
 * @return void
1262
 */
1263
	public function testMoRulesTwelve() {
1264
		Configure::write('Config.language', 'rule_12_mo');
1265
		$this->assertRulesTwelve();
1266
	}
1267
 
1268
/**
1269
 * Assertions for plural rules twelve
1270
 *
1271
 * @return void
1272
 */
1273
	public function assertRulesTwelve() {
1274
		$singular = $this->_singular();
1275
		$this->assertEquals('Plural Rule 12 (translated)', $singular);
1276
 
1277
		$plurals = $this->_plural();
1278
		$this->assertTrue(in_array('0 is 0 or 3-10 (translated)', $plurals));
1279
		$this->assertTrue(in_array('1 is 1 (translated)', $plurals));
1280
		$this->assertTrue(in_array('2 is 2 (translated)', $plurals));
1281
		$this->assertTrue(in_array('3 is 0 or 3-10 (translated)', $plurals));
1282
		$this->assertTrue(in_array('4 is 0 or 3-10 (translated)', $plurals));
1283
		$this->assertTrue(in_array('5 is 0 or 3-10 (translated)', $plurals));
1284
		$this->assertTrue(in_array('6 is 0 or 3-10 (translated)', $plurals));
1285
		$this->assertTrue(in_array('7 is 0 or 3-10 (translated)', $plurals));
1286
		$this->assertTrue(in_array('8 is 0 or 3-10 (translated)', $plurals));
1287
		$this->assertTrue(in_array('9 is 0 or 3-10 (translated)', $plurals));
1288
		$this->assertTrue(in_array('10 is 0 or 3-10 (translated)', $plurals));
1289
		$this->assertTrue(in_array('11 everything else (translated)', $plurals));
1290
		$this->assertTrue(in_array('12 everything else (translated)', $plurals));
1291
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
1292
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
1293
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
1294
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
1295
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
1296
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
1297
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
1298
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
1299
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
1300
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
1301
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
1302
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
1303
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
1304
 
1305
		$coreSingular = $this->_singularFromCore();
1306
		$this->assertEquals('Plural Rule 12 (from core translated)', $coreSingular);
1307
 
1308
		$corePlurals = $this->_pluralFromCore();
1309
		$this->assertTrue(in_array('0 is 0 or 3-10 (from core translated)', $corePlurals));
1310
		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals));
1311
		$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals));
1312
		$this->assertTrue(in_array('3 is 0 or 3-10 (from core translated)', $corePlurals));
1313
		$this->assertTrue(in_array('4 is 0 or 3-10 (from core translated)', $corePlurals));
1314
		$this->assertTrue(in_array('5 is 0 or 3-10 (from core translated)', $corePlurals));
1315
		$this->assertTrue(in_array('6 is 0 or 3-10 (from core translated)', $corePlurals));
1316
		$this->assertTrue(in_array('7 is 0 or 3-10 (from core translated)', $corePlurals));
1317
		$this->assertTrue(in_array('8 is 0 or 3-10 (from core translated)', $corePlurals));
1318
		$this->assertTrue(in_array('9 is 0 or 3-10 (from core translated)', $corePlurals));
1319
		$this->assertTrue(in_array('10 is 0 or 3-10 (from core translated)', $corePlurals));
1320
		$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals));
1321
		$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals));
1322
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
1323
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
1324
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
1325
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
1326
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
1327
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
1328
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
1329
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
1330
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
1331
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
1332
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
1333
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
1334
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
1335
	}
1336
 
1337
/**
1338
 * testMoRulesThirteen method
1339
 *
1340
 * @return void
1341
 */
1342
	public function testmoRulesThirteen() {
1343
		Configure::write('Config.language', 'rule_13_mo');
1344
		$this->assertRulesThirteen();
1345
	}
1346
 
1347
/**
1348
 * testPoRulesThirteen method
1349
 *
1350
 * @return void
1351
 */
1352
	public function testPoRulesThirteen() {
1353
		Configure::write('Config.language', 'rule_13_po');
1354
		$this->assertRulesThirteen();
1355
	}
1356
 
1357
/**
1358
 * Assertions for plural rules thirteen
1359
 *
1360
 * @return void
1361
 */
1362
	public function assertRulesThirteen() {
1363
		$singular = $this->_singular();
1364
		$this->assertEquals('Plural Rule 13 (translated)', $singular);
1365
 
1366
		$plurals = $this->_plural();
1367
		$this->assertTrue(in_array('0 is 0 or ends in 01-10 (translated)', $plurals));
1368
		$this->assertTrue(in_array('1 is 1 (translated)', $plurals));
1369
		$this->assertTrue(in_array('2 is 0 or ends in 01-10 (translated)', $plurals));
1370
		$this->assertTrue(in_array('3 is 0 or ends in 01-10 (translated)', $plurals));
1371
		$this->assertTrue(in_array('4 is 0 or ends in 01-10 (translated)', $plurals));
1372
		$this->assertTrue(in_array('5 is 0 or ends in 01-10 (translated)', $plurals));
1373
		$this->assertTrue(in_array('6 is 0 or ends in 01-10 (translated)', $plurals));
1374
		$this->assertTrue(in_array('7 is 0 or ends in 01-10 (translated)', $plurals));
1375
		$this->assertTrue(in_array('8 is 0 or ends in 01-10 (translated)', $plurals));
1376
		$this->assertTrue(in_array('9 is 0 or ends in 01-10 (translated)', $plurals));
1377
		$this->assertTrue(in_array('10 is 0 or ends in 01-10 (translated)', $plurals));
1378
		$this->assertTrue(in_array('11 ends in 11-20 (translated)', $plurals));
1379
		$this->assertTrue(in_array('12 ends in 11-20 (translated)', $plurals));
1380
		$this->assertTrue(in_array('13 ends in 11-20 (translated)', $plurals));
1381
		$this->assertTrue(in_array('14 ends in 11-20 (translated)', $plurals));
1382
		$this->assertTrue(in_array('15 ends in 11-20 (translated)', $plurals));
1383
		$this->assertTrue(in_array('16 ends in 11-20 (translated)', $plurals));
1384
		$this->assertTrue(in_array('17 ends in 11-20 (translated)', $plurals));
1385
		$this->assertTrue(in_array('18 ends in 11-20 (translated)', $plurals));
1386
		$this->assertTrue(in_array('19 ends in 11-20 (translated)', $plurals));
1387
		$this->assertTrue(in_array('20 ends in 11-20 (translated)', $plurals));
1388
		$this->assertTrue(in_array('21 everything else (translated)', $plurals));
1389
		$this->assertTrue(in_array('22 everything else (translated)', $plurals));
1390
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
1391
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
1392
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
1393
 
1394
		$coreSingular = $this->_singularFromCore();
1395
		$this->assertEquals('Plural Rule 13 (from core translated)', $coreSingular);
1396
 
1397
		$corePlurals = $this->_pluralFromCore();
1398
		$this->assertTrue(in_array('0 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1399
		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals));
1400
		$this->assertTrue(in_array('2 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1401
		$this->assertTrue(in_array('3 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1402
		$this->assertTrue(in_array('4 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1403
		$this->assertTrue(in_array('5 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1404
		$this->assertTrue(in_array('6 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1405
		$this->assertTrue(in_array('7 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1406
		$this->assertTrue(in_array('8 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1407
		$this->assertTrue(in_array('9 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1408
		$this->assertTrue(in_array('10 is 0 or ends in 01-10 (from core translated)', $corePlurals));
1409
		$this->assertTrue(in_array('11 ends in 11-20 (from core translated)', $corePlurals));
1410
		$this->assertTrue(in_array('12 ends in 11-20 (from core translated)', $corePlurals));
1411
		$this->assertTrue(in_array('13 ends in 11-20 (from core translated)', $corePlurals));
1412
		$this->assertTrue(in_array('14 ends in 11-20 (from core translated)', $corePlurals));
1413
		$this->assertTrue(in_array('15 ends in 11-20 (from core translated)', $corePlurals));
1414
		$this->assertTrue(in_array('16 ends in 11-20 (from core translated)', $corePlurals));
1415
		$this->assertTrue(in_array('17 ends in 11-20 (from core translated)', $corePlurals));
1416
		$this->assertTrue(in_array('18 ends in 11-20 (from core translated)', $corePlurals));
1417
		$this->assertTrue(in_array('19 ends in 11-20 (from core translated)', $corePlurals));
1418
		$this->assertTrue(in_array('20 ends in 11-20 (from core translated)', $corePlurals));
1419
		$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals));
1420
		$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals));
1421
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
1422
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
1423
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
1424
	}
1425
 
1426
/**
1427
 * testMoRulesFourteen method
1428
 *
1429
 * @return void
1430
 */
1431
	public function testMoRulesFourteen() {
1432
		Configure::write('Config.language', 'rule_14_mo');
1433
		$this->assertRulesFourteen();
1434
	}
1435
 
1436
/**
1437
 * testPoRulesFourteen method
1438
 *
1439
 * @return void
1440
 */
1441
	public function testPoRulesFourteen() {
1442
		Configure::write('Config.language', 'rule_14_po');
1443
		$this->assertRulesFourteen();
1444
	}
1445
 
1446
/**
1447
 * Assertions for plural rules fourteen
1448
 *
1449
 * @return void
1450
 */
1451
	public function assertRulesFourteen() {
1452
		$singular = $this->_singular();
1453
		$this->assertEquals('Plural Rule 14 (translated)', $singular);
1454
 
1455
		$plurals = $this->_plural();
1456
		$this->assertTrue(in_array('0 everything else (translated)', $plurals));
1457
		$this->assertTrue(in_array('1 ends in 1 (translated)', $plurals));
1458
		$this->assertTrue(in_array('2 ends in 2 (translated)', $plurals));
1459
		$this->assertTrue(in_array('3 everything else (translated)', $plurals));
1460
		$this->assertTrue(in_array('4 everything else (translated)', $plurals));
1461
		$this->assertTrue(in_array('5 everything else (translated)', $plurals));
1462
		$this->assertTrue(in_array('6 everything else (translated)', $plurals));
1463
		$this->assertTrue(in_array('7 everything else (translated)', $plurals));
1464
		$this->assertTrue(in_array('8 everything else (translated)', $plurals));
1465
		$this->assertTrue(in_array('9 everything else (translated)', $plurals));
1466
		$this->assertTrue(in_array('10 everything else (translated)', $plurals));
1467
		$this->assertTrue(in_array('11 ends in 1 (translated)', $plurals));
1468
		$this->assertTrue(in_array('12 ends in 2 (translated)', $plurals));
1469
		$this->assertTrue(in_array('13 everything else (translated)', $plurals));
1470
		$this->assertTrue(in_array('14 everything else (translated)', $plurals));
1471
		$this->assertTrue(in_array('15 everything else (translated)', $plurals));
1472
		$this->assertTrue(in_array('16 everything else (translated)', $plurals));
1473
		$this->assertTrue(in_array('17 everything else (translated)', $plurals));
1474
		$this->assertTrue(in_array('18 everything else (translated)', $plurals));
1475
		$this->assertTrue(in_array('19 everything else (translated)', $plurals));
1476
		$this->assertTrue(in_array('20 everything else (translated)', $plurals));
1477
		$this->assertTrue(in_array('21 ends in 1 (translated)', $plurals));
1478
		$this->assertTrue(in_array('22 ends in 2 (translated)', $plurals));
1479
		$this->assertTrue(in_array('23 everything else (translated)', $plurals));
1480
		$this->assertTrue(in_array('24 everything else (translated)', $plurals));
1481
		$this->assertTrue(in_array('25 everything else (translated)', $plurals));
1482
 
1483
		$coreSingular = $this->_singularFromCore();
1484
		$this->assertEquals('Plural Rule 14 (from core translated)', $coreSingular);
1485
 
1486
		$corePlurals = $this->_pluralFromCore();
1487
		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals));
1488
		$this->assertTrue(in_array('1 ends in 1 (from core translated)', $corePlurals));
1489
		$this->assertTrue(in_array('2 ends in 2 (from core translated)', $corePlurals));
1490
		$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals));
1491
		$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals));
1492
		$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals));
1493
		$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals));
1494
		$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals));
1495
		$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals));
1496
		$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals));
1497
		$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals));
1498
		$this->assertTrue(in_array('11 ends in 1 (from core translated)', $corePlurals));
1499
		$this->assertTrue(in_array('12 ends in 2 (from core translated)', $corePlurals));
1500
		$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals));
1501
		$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals));
1502
		$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals));
1503
		$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals));
1504
		$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals));
1505
		$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals));
1506
		$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals));
1507
		$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals));
1508
		$this->assertTrue(in_array('21 ends in 1 (from core translated)', $corePlurals));
1509
		$this->assertTrue(in_array('22 ends in 2 (from core translated)', $corePlurals));
1510
		$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals));
1511
		$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals));
1512
		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
1513
	}
1514
 
1515
/**
1516
 * testSetLanguageWithSession method
1517
 *
1518
 * @return void
1519
 */
1520
	public function testSetLanguageWithSession() {
1521
		CakeSession::write('Config.language', 'po');
1522
		$singular = $this->_singular();
1523
		$this->assertEquals('Po (translated)', $singular);
1524
 
1525
		$plurals = $this->_plural();
1526
		$this->assertTrue(in_array('0 everything else (po translated)', $plurals));
1527
		$this->assertTrue(in_array('1 is 1 (po translated)', $plurals));
1528
		$this->assertTrue(in_array('2 is 2-4 (po translated)', $plurals));
1529
		$this->assertTrue(in_array('3 is 2-4 (po translated)', $plurals));
1530
		$this->assertTrue(in_array('4 is 2-4 (po translated)', $plurals));
1531
		$this->assertTrue(in_array('5 everything else (po translated)', $plurals));
1532
		$this->assertTrue(in_array('6 everything else (po translated)', $plurals));
1533
		$this->assertTrue(in_array('7 everything else (po translated)', $plurals));
1534
		$this->assertTrue(in_array('8 everything else (po translated)', $plurals));
1535
		$this->assertTrue(in_array('9 everything else (po translated)', $plurals));
1536
		$this->assertTrue(in_array('10 everything else (po translated)', $plurals));
1537
		$this->assertTrue(in_array('11 everything else (po translated)', $plurals));
1538
		$this->assertTrue(in_array('12 everything else (po translated)', $plurals));
1539
		$this->assertTrue(in_array('13 everything else (po translated)', $plurals));
1540
		$this->assertTrue(in_array('14 everything else (po translated)', $plurals));
1541
		$this->assertTrue(in_array('15 everything else (po translated)', $plurals));
1542
		$this->assertTrue(in_array('16 everything else (po translated)', $plurals));
1543
		$this->assertTrue(in_array('17 everything else (po translated)', $plurals));
1544
		$this->assertTrue(in_array('18 everything else (po translated)', $plurals));
1545
		$this->assertTrue(in_array('19 everything else (po translated)', $plurals));
1546
		$this->assertTrue(in_array('20 everything else (po translated)', $plurals));
1547
		$this->assertTrue(in_array('21 everything else (po translated)', $plurals));
1548
		$this->assertTrue(in_array('22 everything else (po translated)', $plurals));
1549
		$this->assertTrue(in_array('23 everything else (po translated)', $plurals));
1550
		$this->assertTrue(in_array('24 everything else (po translated)', $plurals));
1551
		$this->assertTrue(in_array('25 everything else (po translated)', $plurals));
1552
		CakeSession::delete('Config.language');
1553
	}
1554
 
1555
/**
1556
 * testNoCoreTranslation method
1557
 *
1558
 * @return void
1559
 */
1560
	public function testNoCoreTranslation() {
1561
		Configure::write('Config.language', 'po');
1562
		$singular = $this->_singular();
1563
		$this->assertEquals('Po (translated)', $singular);
1564
 
1565
		$coreSingular = $this->_singularFromCore();
1566
		$this->assertNotEquals('Po (from core translated)', $coreSingular);
1567
 
1568
		$corePlurals = $this->_pluralFromCore();
1569
		$this->assertFalse(in_array('0 everything else (from core translated)', $corePlurals));
1570
		$this->assertFalse(in_array('1 is 1 (from core translated)', $corePlurals));
1571
		$this->assertFalse(in_array('2 is 2-4 (from core translated)', $corePlurals));
1572
		$this->assertFalse(in_array('3 is 2-4 (from core translated)', $corePlurals));
1573
		$this->assertFalse(in_array('4 is 2-4 (from core translated)', $corePlurals));
1574
		$this->assertFalse(in_array('5 everything else (from core translated)', $corePlurals));
1575
		$this->assertFalse(in_array('6 everything else (from core translated)', $corePlurals));
1576
		$this->assertFalse(in_array('7 everything else (from core translated)', $corePlurals));
1577
		$this->assertFalse(in_array('8 everything else (from core translated)', $corePlurals));
1578
		$this->assertFalse(in_array('9 everything else (from core translated)', $corePlurals));
1579
		$this->assertFalse(in_array('10 everything else (from core translated)', $corePlurals));
1580
		$this->assertFalse(in_array('11 everything else (from core translated)', $corePlurals));
1581
		$this->assertFalse(in_array('12 everything else (from core translated)', $corePlurals));
1582
		$this->assertFalse(in_array('13 everything else (from core translated)', $corePlurals));
1583
		$this->assertFalse(in_array('14 everything else (from core translated)', $corePlurals));
1584
		$this->assertFalse(in_array('15 everything else (from core translated)', $corePlurals));
1585
		$this->assertFalse(in_array('16 everything else (from core translated)', $corePlurals));
1586
		$this->assertFalse(in_array('17 everything else (from core translated)', $corePlurals));
1587
		$this->assertFalse(in_array('18 everything else (from core translated)', $corePlurals));
1588
		$this->assertFalse(in_array('19 everything else (from core translated)', $corePlurals));
1589
		$this->assertFalse(in_array('20 everything else (from core translated)', $corePlurals));
1590
		$this->assertFalse(in_array('21 everything else (from core translated)', $corePlurals));
1591
		$this->assertFalse(in_array('22 everything else (from core translated)', $corePlurals));
1592
		$this->assertFalse(in_array('23 everything else (from core translated)', $corePlurals));
1593
		$this->assertFalse(in_array('24 everything else (from core translated)', $corePlurals));
1594
		$this->assertFalse(in_array('25 everything else (from core translated)', $corePlurals));
1595
	}
1596
 
1597
/**
1598
 * testPluginTranslation method
1599
 *
1600
 * @return void
1601
 */
1602
	public function testPluginTranslation() {
1603
		App::build(array(
1604
			'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
1605
		));
1606
 
1607
		Configure::write('Config.language', 'po');
1608
		$singular = $this->_domainSingular();
1609
		$this->assertEquals('Plural Rule 1 (from plugin)', $singular);
1610
 
1611
		$plurals = $this->_domainPlural();
1612
		$this->assertTrue(in_array('0 = 0 or > 1 (from plugin)', $plurals));
1613
		$this->assertTrue(in_array('1 = 1 (from plugin)', $plurals));
1614
		$this->assertTrue(in_array('2 = 0 or > 1 (from plugin)', $plurals));
1615
		$this->assertTrue(in_array('3 = 0 or > 1 (from plugin)', $plurals));
1616
		$this->assertTrue(in_array('4 = 0 or > 1 (from plugin)', $plurals));
1617
		$this->assertTrue(in_array('5 = 0 or > 1 (from plugin)', $plurals));
1618
		$this->assertTrue(in_array('6 = 0 or > 1 (from plugin)', $plurals));
1619
		$this->assertTrue(in_array('7 = 0 or > 1 (from plugin)', $plurals));
1620
		$this->assertTrue(in_array('8 = 0 or > 1 (from plugin)', $plurals));
1621
		$this->assertTrue(in_array('9 = 0 or > 1 (from plugin)', $plurals));
1622
		$this->assertTrue(in_array('10 = 0 or > 1 (from plugin)', $plurals));
1623
		$this->assertTrue(in_array('11 = 0 or > 1 (from plugin)', $plurals));
1624
		$this->assertTrue(in_array('12 = 0 or > 1 (from plugin)', $plurals));
1625
		$this->assertTrue(in_array('13 = 0 or > 1 (from plugin)', $plurals));
1626
		$this->assertTrue(in_array('14 = 0 or > 1 (from plugin)', $plurals));
1627
		$this->assertTrue(in_array('15 = 0 or > 1 (from plugin)', $plurals));
1628
		$this->assertTrue(in_array('16 = 0 or > 1 (from plugin)', $plurals));
1629
		$this->assertTrue(in_array('17 = 0 or > 1 (from plugin)', $plurals));
1630
		$this->assertTrue(in_array('18 = 0 or > 1 (from plugin)', $plurals));
1631
		$this->assertTrue(in_array('19 = 0 or > 1 (from plugin)', $plurals));
1632
		$this->assertTrue(in_array('20 = 0 or > 1 (from plugin)', $plurals));
1633
		$this->assertTrue(in_array('21 = 0 or > 1 (from plugin)', $plurals));
1634
		$this->assertTrue(in_array('22 = 0 or > 1 (from plugin)', $plurals));
1635
		$this->assertTrue(in_array('23 = 0 or > 1 (from plugin)', $plurals));
1636
		$this->assertTrue(in_array('24 = 0 or > 1 (from plugin)', $plurals));
1637
		$this->assertTrue(in_array('25 = 0 or > 1 (from plugin)', $plurals));
1638
	}
1639
 
1640
/**
1641
 * testPoMultipleLineTranslation method
1642
 *
1643
 * @return void
1644
 */
1645
	public function testPoMultipleLineTranslation() {
1646
		Configure::write('Config.language', 'po');
1647
 
1648
		$string = "This is a multiline translation\n";
1649
		$string .= "broken up over multiple lines.\n";
1650
		$string .= "This is the third line.\n";
1651
		$string .= "This is the forth line.";
1652
		$result = __($string);
1653
 
1654
		$expected = "This is a multiline translation\n";
1655
		$expected .= "broken up over multiple lines.\n";
1656
		$expected .= "This is the third line.\n";
1657
		$expected .= "This is the forth line. (translated)";
1658
		$this->assertEquals($expected, $result);
1659
 
1660
		// Windows Newline is \r\n
1661
		$string = "This is a multiline translation\r\n";
1662
		$string .= "broken up over multiple lines.\r\n";
1663
		$string .= "This is the third line.\r\n";
1664
		$string .= "This is the forth line.";
1665
		$result = __($string);
1666
		$this->assertEquals($expected, $result);
1667
 
1668
		$singular = "valid\nsecond line";
1669
		$plural = "valids\nsecond line";
1670
 
1671
		$result = __n($singular, $plural, 1);
1672
		$expected = "v\nsecond line";
1673
		$this->assertEquals($expected, $result);
1674
 
1675
		$result = __n($singular, $plural, 2);
1676
		$expected = "vs\nsecond line";
1677
		$this->assertEquals($expected, $result);
1678
 
1679
		$string = "This is a multiline translation\n";
1680
		$string .= "broken up over multiple lines.\n";
1681
		$string .= "This is the third line.\n";
1682
		$string .= "This is the forth line.";
1683
 
1684
		$singular = "%d = 1\n" . $string;
1685
		$plural = "%d = 0 or > 1\n" . $string;
1686
 
1687
		$result = __n($singular, $plural, 1);
1688
		$expected = "%d is 1\n" . $string;
1689
		$this->assertEquals($expected, $result);
1690
 
1691
		$result = __n($singular, $plural, 2);
1692
		$expected = "%d is 2-4\n" . $string;
1693
		$this->assertEquals($expected, $result);
1694
 
1695
		// Windows Newline is \r\n
1696
		$string = "This is a multiline translation\r\n";
1697
		$string .= "broken up over multiple lines.\r\n";
1698
		$string .= "This is the third line.\r\n";
1699
		$string .= "This is the forth line.";
1700
 
1701
		$singular = "%d = 1\r\n" . $string;
1702
		$plural = "%d = 0 or > 1\r\n" . $string;
1703
 
1704
		$result = __n($singular, $plural, 1);
1705
		$expected = "%d is 1\n" . str_replace("\r\n", "\n", $string);
1706
		$this->assertEquals($expected, $result);
1707
 
1708
		$result = __n($singular, $plural, 2);
1709
		$expected = "%d is 2-4\n" . str_replace("\r\n", "\n", $string);
1710
		$this->assertEquals($expected, $result);
1711
	}
1712
 
1713
/**
1714
 * testPoNoTranslationNeeded method
1715
 *
1716
 * @return void
1717
 */
1718
	public function testPoNoTranslationNeeded() {
1719
		Configure::write('Config.language', 'po');
1720
		$result = __('No Translation needed');
1721
		$this->assertEquals('No Translation needed', $result);
1722
	}
1723
 
1724
/**
1725
 * testPoQuotedString method
1726
 *
1727
 * @return void
1728
 */
1729
	public function testPoQuotedString() {
1730
		Configure::write('Config.language', 'po');
1731
		$expected = 'this is a "quoted string" (translated)';
1732
		$this->assertEquals($expected, __('this is a "quoted string"'));
1733
	}
1734
 
1735
/**
1736
 * testFloatValue method
1737
 *
1738
 * @return void
1739
 */
1740
	public function testFloatValue() {
1741
		Configure::write('Config.language', 'rule_9_po');
1742
 
1743
		$result = __n('%d = 1', '%d = 0 or > 1', (float)1);
1744
		$expected = '%d is 1 (translated)';
1745
		$this->assertEquals($expected, $result);
1746
 
1747
		$result = __n('%d = 1', '%d = 0 or > 1', (float)2);
1748
		$expected = "%d ends in 2-4, not 12-14 (translated)";
1749
		$this->assertEquals($expected, $result);
1750
 
1751
		$result = __n('%d = 1', '%d = 0 or > 1', (float)5);
1752
		$expected = "%d everything else (translated)";
1753
		$this->assertEquals($expected, $result);
1754
	}
1755
 
1756
/**
1757
 * testCategory method
1758
 *
1759
 * @return void
1760
 */
1761
	public function testCategory() {
1762
		Configure::write('Config.language', 'po');
1763
		// Test with default (I18n constant) category.
1764
		$category = $this->_category();
1765
		$this->assertEquals('Monetary Po (translated)', $category);
1766
		// Test with category number represenation.
1767
		$category = $this->_category(3);
1768
		$this->assertEquals('Monetary Po (translated)', $category);
1769
	}
1770
 
1771
/**
1772
 * testPluginCategory method
1773
 *
1774
 * @return void
1775
 */
1776
	public function testPluginCategory() {
1777
		Configure::write('Config.language', 'po');
1778
 
1779
		$singular = $this->_domainCategorySingular();
1780
		$this->assertEquals('Monetary Plural Rule 1 (from plugin)', $singular);
1781
 
1782
		$plurals = $this->_domainCategoryPlural();
1783
		$this->assertTrue(in_array('Monetary 0 = 0 or > 1 (from plugin)', $plurals));
1784
		$this->assertTrue(in_array('Monetary 1 = 1 (from plugin)', $plurals));
1785
	}
1786
 
1787
/**
1788
 * testCategoryThenSingular method
1789
 *
1790
 * @return void
1791
 */
1792
	public function testCategoryThenSingular() {
1793
		Configure::write('Config.language', 'po');
1794
		$category = $this->_category();
1795
		$this->assertEquals('Monetary Po (translated)', $category);
1796
 
1797
		$singular = $this->_singular();
1798
		$this->assertEquals('Po (translated)', $singular);
1799
	}
1800
 
1801
/**
1802
 * testTimeDefinition method
1803
 *
1804
 * @return void
1805
 */
1806
	public function testTimeDefinition() {
1807
		Configure::write('Config.language', 'po');
1808
		$result = __c('d_fmt', 5);
1809
		$expected = '%m/%d/%Y';
1810
		$this->assertEquals($expected, $result);
1811
 
1812
		$result = __c('am_pm', 5);
1813
		$expected = array('AM', 'PM');
1814
		$this->assertEquals($expected, $result);
1815
 
1816
		$result = __c('abmon', 5);
1817
		$expected = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
1818
		$this->assertEquals($expected, $result);
1819
	}
1820
 
1821
/**
1822
 * testTimeDefinitionJapanese method
1823
 *
1824
 * @return void
1825
 */
1826
	public function testTimeDefinitionJapanese() {
1827
		Configure::write('Config.language', 'ja_jp');
1828
		$result = __c('d_fmt', 5);
1829
 
1830
		$expected = "%Y年%m月%d日";
1831
 
1832
		$this->assertEquals($expected, $result);
1833
 
1834
		$result = __c('am_pm', 5);
1835
		$expected = array("午前", "午後");
1836
		$this->assertEquals($expected, $result);
1837
 
1838
		$result = __c('abmon', 5);
1839
		$expected = array(" 1月", " 2月", " 3月", " 4月", " 5月", " 6月", " 7月", " 8月", " 9月", "10月", "11月", "12月");
1840
		$this->assertEquals($expected, $result);
1841
	}
1842
 
1843
/**
1844
 * testTranslateLanguageParam method
1845
 *
1846
 * @return void
1847
 */
1848
	public function testTranslateLanguageParam() {
1849
		Configure::write('Config.language', 'rule_0_po');
1850
 
1851
		$result = I18n::translate('Plural Rule 1', null, null, I18n::LC_MESSAGES);
1852
		$expected = 'Plural Rule 0 (translated)';
1853
		$this->assertEquals($expected, $result);
1854
 
1855
		$result = I18n::translate('Plural Rule 1', null, null, I18n::LC_MESSAGES, null, 'rule_1_po');
1856
		$expected = 'Plural Rule 1 (translated)';
1857
		$this->assertEquals($expected, $result);
1858
	}
1859
 
1860
/**
1861
 * Test that the '' domain causes exceptions.
1862
 *
1863
 * @expectedException CakeException
1864
 * @return void
1865
 */
1866
	public function testTranslateEmptyDomain() {
1867
		I18n::translate('Plural Rule 1', null, '');
1868
	}
1869
 
1870
/**
1871
 * testLoadLocaleDefinition method
1872
 *
1873
 * @return void
1874
 */
1875
	public function testLoadLocaleDefinition() {
1876
		$path = current(App::path('locales'));
1877
		$result = I18n::loadLocaleDefinition($path . 'nld' . DS . 'LC_TIME');
1878
		$expected = array('zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag');
1879
		$this->assertSame($expected, $result['day']);
1880
	}
1881
 
1882
/**
1883
 * Singular method
1884
 *
1885
 * @return void
1886
 */
1887
	protected function _domainCategorySingular($domain = 'test_plugin', $category = 3) {
1888
		$singular = __dc($domain, 'Plural Rule 1', $category);
1889
		return $singular;
1890
	}
1891
 
1892
/**
1893
 * Plural method
1894
 *
1895
 * @return void
1896
 */
1897
	protected function _domainCategoryPlural($domain = 'test_plugin', $category = 3) {
1898
		$plurals = array();
1899
		for ($number = 0; $number <= 25; $number++) {
1900
			$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category), (float)$number);
1901
		}
1902
		return $plurals;
1903
	}
1904
 
1905
/**
1906
 * Singular method
1907
 *
1908
 * @return void
1909
 */
1910
	protected function _domainSingular($domain = 'test_plugin') {
1911
		$singular = __d($domain, 'Plural Rule 1');
1912
		return $singular;
1913
	}
1914
 
1915
/**
1916
 * Plural method
1917
 *
1918
 * @return void
1919
 */
1920
	protected function _domainPlural($domain = 'test_plugin') {
1921
		$plurals = array();
1922
		for ($number = 0; $number <= 25; $number++) {
1923
			$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
1924
		}
1925
		return $plurals;
1926
	}
1927
 
1928
/**
1929
 * category method
1930
 *
1931
 * @return void
1932
 */
1933
	protected function _category($category = I18n::LC_MONETARY) {
1934
		$singular = __c('Plural Rule 1', $category);
1935
		return $singular;
1936
	}
1937
 
1938
/**
1939
 * Singular method
1940
 *
1941
 * @return void
1942
 */
1943
	protected function _singular() {
1944
		$singular = __('Plural Rule 1');
1945
		return $singular;
1946
	}
1947
 
1948
/**
1949
 * Plural method
1950
 *
1951
 * @return void
1952
 */
1953
	protected function _plural() {
1954
		$plurals = array();
1955
		for ($number = 0; $number <= 25; $number++) {
1956
			$plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
1957
		}
1958
		return $plurals;
1959
	}
1960
 
1961
/**
1962
 * singularFromCore method
1963
 *
1964
 * @return void
1965
 */
1966
	protected function _singularFromCore() {
1967
		$singular = __('Plural Rule 1 (from core)');
1968
		return $singular;
1969
	}
1970
 
1971
/**
1972
 * pluralFromCore method
1973
 *
1974
 * @return void
1975
 */
1976
	protected function _pluralFromCore() {
1977
		$plurals = array();
1978
		for ($number = 0; $number <= 25; $number++) {
1979
			$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number);
1980
		}
1981
		return $plurals;
1982
	}
1983
}