mirror of
				https://github.com/brmlab/brmsklad.git
				synced 2025-10-31 00:03:58 +01:00 
			
		
		
		
	Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
		
							parent
							
								
									5a580df460
								
							
						
					
					
						commit
						235a541597
					
				
					 793 changed files with 60746 additions and 23753 deletions
				
			
		|  | @ -2,21 +2,22 @@ | |||
| /** | ||||
|  * I18nTest file | ||||
|  * | ||||
|  * PHP 5 | ||||
|  * | ||||
|  * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> | ||||
|  * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||||
|  * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | ||||
|  * | ||||
|  * Licensed under The MIT License | ||||
|  * For full copyright and license information, please see the LICENSE.txt | ||||
|  * Redistributions of files must retain the above copyright notice | ||||
|  * | ||||
|  * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||||
|  * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | ||||
|  * @link          http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests | ||||
|  * @package       Cake.Test.Case.I18n | ||||
|  * @since         CakePHP(tm) v 1.2.0.5432 | ||||
|  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php) | ||||
|  * @license       http://www.opensource.org/licenses/mit-license.php MIT License | ||||
|  */ | ||||
| 
 | ||||
| App::uses('I18n', 'I18n'); | ||||
| App::uses('CakeSession', 'Model/Datasource'); | ||||
| 
 | ||||
| /** | ||||
|  * I18nTest class | ||||
|  | @ -74,15 +75,15 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertEquals('Dom 1 Foo', I18n::translate('dom1.foo', false, 'dom1')); | ||||
| 		$this->assertEquals('Dom 1 Bar', I18n::translate('dom1.bar', false, 'dom1')); | ||||
| 		$domains = I18n::domains(); | ||||
| 		$this->assertEquals('Dom 1 Foo', $domains['dom1']['cache_test_po']['LC_MESSAGES']['dom1.foo']); | ||||
| 		$this->assertEquals('Dom 1 Foo', $domains['dom1']['cache_test_po']['LC_MESSAGES']['dom1.foo']['']); | ||||
| 
 | ||||
| 		// reset internally stored entries
 | ||||
| 		I18n::clear(); | ||||
| 
 | ||||
| 		// now only dom1 should be in cache
 | ||||
| 		$cachedDom1 = Cache::read('dom1_' . $lang, '_cake_core_'); | ||||
| 		$this->assertEquals('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']); | ||||
| 		$this->assertEquals('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']); | ||||
| 		$this->assertEquals('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']['']); | ||||
| 		$this->assertEquals('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']['']); | ||||
| 		// dom2 not in cache
 | ||||
| 		$this->assertFalse(Cache::read('dom2_' . $lang, '_cake_core_')); | ||||
| 
 | ||||
|  | @ -91,11 +92,11 @@ class I18nTest extends CakeTestCase { | |||
| 
 | ||||
| 		// verify dom2 was cached through manual read from cache
 | ||||
| 		$cachedDom2 = Cache::read('dom2_' . $lang, '_cake_core_'); | ||||
| 		$this->assertEquals('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']); | ||||
| 		$this->assertEquals('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']); | ||||
| 		$this->assertEquals('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']['']); | ||||
| 		$this->assertEquals('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']['']); | ||||
| 
 | ||||
| 		// modify cache entry manually to verify that dom1 entries now will be read from cache
 | ||||
| 		$cachedDom1['LC_MESSAGES']['dom1.foo'] = 'FOO'; | ||||
| 		$cachedDom1['LC_MESSAGES']['dom1.foo'][''] = 'FOO'; | ||||
| 		Cache::write('dom1_' . $lang, $cachedDom1, '_cake_core_'); | ||||
| 		$this->assertEquals('FOO', I18n::translate('dom1.foo', false, 'dom1')); | ||||
| 	} | ||||
|  | @ -106,10 +107,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function testDefaultStrings() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 1', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or > 1', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 = 0 or > 1', $plurals)); | ||||
|  | @ -137,10 +138,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 = 0 or > 1', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 = 0 or > 1', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 1 (from core)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or > 1 (from core)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (from core)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 = 0 or > 1 (from core)', $corePlurals)); | ||||
|  | @ -192,13 +193,13 @@ class I18nTest extends CakeTestCase { | |||
| /** | ||||
|  * Assertions for rules zero. | ||||
|  * | ||||
|  * @return | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesZero() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 0 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 ends with any # (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 ends with any # (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 ends with any # (translated)', $plurals)); | ||||
|  | @ -226,10 +227,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 ends with any # (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 ends with any # (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 0 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 ends with any # (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 ends with any # (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 ends with any # (from core translated)', $corePlurals)); | ||||
|  | @ -284,10 +285,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesOne() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 1 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or > 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 = 0 or > 1 (translated)', $plurals)); | ||||
|  | @ -315,10 +316,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 = 0 or > 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 = 0 or > 1 (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 1 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or > 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 = 0 or > 1 (from core translated)', $corePlurals)); | ||||
|  | @ -373,10 +374,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesTwo() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 2 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 = 0 or 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 > 1 (translated)', $plurals)); | ||||
|  | @ -404,10 +405,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 > 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 > 1 (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 2 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 = 0 or 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 > 1 (from core translated)', $corePlurals)); | ||||
|  | @ -462,10 +463,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesThree() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 3 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 = 0 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 ends 1 but not 11 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 everything else (translated)', $plurals)); | ||||
|  | @ -493,10 +494,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 3 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 = 0 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 ends 1 but not 11 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals)); | ||||
|  | @ -551,10 +552,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesFour() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 4 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 = 2 (translated)', $plurals)); | ||||
|  | @ -582,10 +583,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 4 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 = 2 (from core translated)', $corePlurals)); | ||||
|  | @ -640,10 +641,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesFive() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 5 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (translated)', $plurals)); | ||||
|  | @ -672,10 +673,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 5 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('0 = 0 or ends in 01-19 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals)); | ||||
|  | @ -731,10 +732,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesSix() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 6 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 ends in 0 or ends in 10-20 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1, not 11 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 everything else (translated)', $plurals)); | ||||
|  | @ -762,10 +763,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 6 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1, not 11 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals)); | ||||
|  | @ -820,10 +821,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesSeven() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 7 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1, not 11 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (translated)', $plurals)); | ||||
|  | @ -851,10 +852,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 7 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1, not 11 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); | ||||
|  | @ -909,10 +910,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesEight() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 8 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2-4 (translated)', $plurals)); | ||||
|  | @ -940,10 +941,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 8 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2-4 (from core translated)', $corePlurals)); | ||||
|  | @ -998,10 +999,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesNine() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 9 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); | ||||
|  | @ -1030,10 +1031,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 9 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
|  | @ -1090,10 +1091,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesTen() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 10 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1 (translated)', $plurals)); | ||||
|  | @ -1122,10 +1123,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 10 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1 (from core translated)', $corePlurals)); | ||||
|  | @ -1181,10 +1182,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesEleven() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 11 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2 (translated)', $plurals)); | ||||
|  | @ -1212,10 +1213,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 11 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals)); | ||||
|  | @ -1270,10 +1271,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesTwelve() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 12 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 is 0 or 3-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2 (translated)', $plurals)); | ||||
|  | @ -1301,10 +1302,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 12 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 is 0 or 3-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals)); | ||||
|  | @ -1359,10 +1360,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesThirteen() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 13 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 is 0 or ends in 01-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 is 0 or ends in 01-10 (translated)', $plurals)); | ||||
|  | @ -1390,10 +1391,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 13 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 is 0 or ends in 01-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 is 0 or ends in 01-10 (from core translated)', $corePlurals)); | ||||
|  | @ -1448,10 +1449,10 @@ class I18nTest extends CakeTestCase { | |||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesFourteen() { | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 14 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 ends in 2 (translated)', $plurals)); | ||||
|  | @ -1479,10 +1480,10 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('24 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 14 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 ends in 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 ends in 2 (from core translated)', $corePlurals)); | ||||
|  | @ -1511,17 +1512,138 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * testMoRulesFifteen method | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testMoRulesFifteen() { | ||||
| 		Configure::write('Config.language', 'rule_15_mo'); | ||||
| 		$this->assertRulesFifteen(); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * testPoRulesFifteen method | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testPoRulesFifteen() { | ||||
| 		Configure::write('Config.language', 'rule_15_po'); | ||||
| 		$this->assertRulesFifteen(); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Assertions for plural rules fifteen | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function assertRulesFifteen() { | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Plural Rule 15 (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->_plural(111); | ||||
| 		$this->assertTrue(in_array('0 is 0 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('3 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('4 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('5 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('6 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('7 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('8 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('9 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('10 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('11 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('12 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('13 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('14 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('15 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('16 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('17 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('18 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('19 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('20 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('31 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('42 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('53 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('64 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('75 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('86 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('97 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('98 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('99 ends with 11-99 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('100 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('101 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('102 everything else (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('103 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('104 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('105 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('106 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('107 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('108 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('109 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('110 ends with 03-10 (translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('111 ends with 11-99 (translated)', $plurals)); | ||||
| 
 | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertEquals('Plural Rule 15 (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->_pluralFromCore(111); | ||||
| 		$this->assertTrue(in_array('0 is 0 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('3 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('4 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('5 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('6 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('7 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('8 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('9 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('10 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('11 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('12 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('13 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('14 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('15 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('16 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('17 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('18 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('19 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('20 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('31 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('42 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('53 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('64 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('75 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('86 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('97 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('98 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('99 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('100 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('101 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('102 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('103 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('104 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('105 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('106 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('107 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('108 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('109 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('110 ends with 03-10 (from core translated)', $corePlurals)); | ||||
| 		$this->assertTrue(in_array('111 ends with 11-99 (from core translated)', $corePlurals)); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * testSetLanguageWithSession method | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testSetLanguageWithSession() { | ||||
| 		$_SESSION['Config']['language'] = 'po'; | ||||
| 		$singular = $this->__singular(); | ||||
| 		CakeSession::write('Config.language', 'po'); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Po (translated)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__plural(); | ||||
| 		$plurals = $this->_plural(); | ||||
| 		$this->assertTrue(in_array('0 everything else (po translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 is 1 (po translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 is 2-4 (po translated)', $plurals)); | ||||
|  | @ -1548,7 +1670,7 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('23 everything else (po translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('24 everything else (po translated)', $plurals)); | ||||
| 		$this->assertTrue(in_array('25 everything else (po translated)', $plurals)); | ||||
| 		unset($_SESSION['Config']['language']); | ||||
| 		CakeSession::delete('Config.language'); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  | @ -1558,13 +1680,13 @@ class I18nTest extends CakeTestCase { | |||
|  */ | ||||
| 	public function testNoCoreTranslation() { | ||||
| 		Configure::write('Config.language', 'po'); | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Po (translated)', $singular); | ||||
| 
 | ||||
| 		$coreSingular = $this->__singularFromCore(); | ||||
| 		$coreSingular = $this->_singularFromCore(); | ||||
| 		$this->assertNotEquals('Po (from core translated)', $coreSingular); | ||||
| 
 | ||||
| 		$corePlurals = $this->__pluralFromCore(); | ||||
| 		$corePlurals = $this->_pluralFromCore(); | ||||
| 		$this->assertFalse(in_array('0 everything else (from core translated)', $corePlurals)); | ||||
| 		$this->assertFalse(in_array('1 is 1 (from core translated)', $corePlurals)); | ||||
| 		$this->assertFalse(in_array('2 is 2-4 (from core translated)', $corePlurals)); | ||||
|  | @ -1604,10 +1726,10 @@ class I18nTest extends CakeTestCase { | |||
| 		)); | ||||
| 
 | ||||
| 		Configure::write('Config.language', 'po'); | ||||
| 		$singular = $this->__domainSingular(); | ||||
| 		$singular = $this->_domainSingular(); | ||||
| 		$this->assertEquals('Plural Rule 1 (from plugin)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__domainPlural(); | ||||
| 		$plurals = $this->_domainPlural(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or > 1 (from plugin)', $plurals)); | ||||
| 		$this->assertTrue(in_array('1 = 1 (from plugin)', $plurals)); | ||||
| 		$this->assertTrue(in_array('2 = 0 or > 1 (from plugin)', $plurals)); | ||||
|  | @ -1636,6 +1758,30 @@ class I18nTest extends CakeTestCase { | |||
| 		$this->assertTrue(in_array('25 = 0 or > 1 (from plugin)', $plurals)); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test that Configure::read('I18n.preferApp') will prefer app. | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testPluginTranslationPreferApp() { | ||||
| 		// Reset internally stored entries
 | ||||
| 		I18n::clear(); | ||||
| 		Cache::clear(false, '_cake_core_'); | ||||
| 
 | ||||
| 		Configure::write('I18n.preferApp', true); | ||||
| 
 | ||||
| 		App::build(array( | ||||
| 			'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) | ||||
| 		)); | ||||
| 
 | ||||
| 		Configure::write('Config.language', 'po'); | ||||
| 		$singular = $this->_domainSingular(); | ||||
| 		$this->assertEquals('Plural Rule 1', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->_domainPlural(); | ||||
| 		$this->assertTrue(in_array('0 = 0 or > 1', $plurals)); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * testPoMultipleLineTranslation method | ||||
|  * | ||||
|  | @ -1759,7 +1905,11 @@ class I18nTest extends CakeTestCase { | |||
|  */ | ||||
| 	public function testCategory() { | ||||
| 		Configure::write('Config.language', 'po'); | ||||
| 		$category = $this->__category(); | ||||
| 		// Test with default (I18n constant) category.
 | ||||
| 		$category = $this->_category(); | ||||
| 		$this->assertEquals('Monetary Po (translated)', $category); | ||||
| 		// Test with category number represenation.
 | ||||
| 		$category = $this->_category(3); | ||||
| 		$this->assertEquals('Monetary Po (translated)', $category); | ||||
| 	} | ||||
| 
 | ||||
|  | @ -1771,10 +1921,10 @@ class I18nTest extends CakeTestCase { | |||
| 	public function testPluginCategory() { | ||||
| 		Configure::write('Config.language', 'po'); | ||||
| 
 | ||||
| 		$singular = $this->__domainCategorySingular(); | ||||
| 		$singular = $this->_domainCategorySingular(); | ||||
| 		$this->assertEquals('Monetary Plural Rule 1 (from plugin)', $singular); | ||||
| 
 | ||||
| 		$plurals = $this->__domainCategoryPlural(); | ||||
| 		$plurals = $this->_domainCategoryPlural(); | ||||
| 		$this->assertTrue(in_array('Monetary 0 = 0 or > 1 (from plugin)', $plurals)); | ||||
| 		$this->assertTrue(in_array('Monetary 1 = 1 (from plugin)', $plurals)); | ||||
| 	} | ||||
|  | @ -1786,10 +1936,10 @@ class I18nTest extends CakeTestCase { | |||
|  */ | ||||
| 	public function testCategoryThenSingular() { | ||||
| 		Configure::write('Config.language', 'po'); | ||||
| 		$category = $this->__category(); | ||||
| 		$category = $this->_category(); | ||||
| 		$this->assertEquals('Monetary Po (translated)', $category); | ||||
| 
 | ||||
| 		$singular = $this->__singular(); | ||||
| 		$singular = $this->_singular(); | ||||
| 		$this->assertEquals('Po (translated)', $singular); | ||||
| 	} | ||||
| 
 | ||||
|  | @ -1843,21 +1993,78 @@ class I18nTest extends CakeTestCase { | |||
| 	public function testTranslateLanguageParam() { | ||||
| 		Configure::write('Config.language', 'rule_0_po'); | ||||
| 
 | ||||
| 		$result = I18n::translate('Plural Rule 1', null, null, 6); | ||||
| 		$result = I18n::translate('Plural Rule 1', null, null, I18n::LC_MESSAGES); | ||||
| 		$expected = 'Plural Rule 0 (translated)'; | ||||
| 		$this->assertEquals($expected, $result); | ||||
| 
 | ||||
| 		$result = I18n::translate('Plural Rule 1', null, null, 6, null, 'rule_1_po'); | ||||
| 		$result = I18n::translate('Plural Rule 1', null, null, I18n::LC_MESSAGES, null, 'rule_1_po'); | ||||
| 		$expected = 'Plural Rule 1 (translated)'; | ||||
| 		$this->assertEquals($expected, $result); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test that the '' domain causes exceptions. | ||||
|  * | ||||
|  * @expectedException CakeException | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testTranslateEmptyDomain() { | ||||
| 		I18n::translate('Plural Rule 1', null, ''); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * testLoadLocaleDefinition method | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testLoadLocaleDefinition() { | ||||
| 		$path = current(App::path('locales')); | ||||
| 		$result = I18n::loadLocaleDefinition($path . 'nld' . DS . 'LC_TIME'); | ||||
| 		$expected = array('zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'); | ||||
| 		$this->assertSame($expected, $result['day']); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test basic context support | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testContext() { | ||||
| 		Configure::write('Config.language', 'nld'); | ||||
| 
 | ||||
| 		$this->assertSame("brief", __x('mail', 'letter')); | ||||
| 		$this->assertSame("letter", __x('character', 'letter')); | ||||
| 		$this->assertSame("bal", __x('spherical object', 'ball')); | ||||
| 		$this->assertSame("danspartij", __x('social gathering', 'ball')); | ||||
| 		$this->assertSame("balans", __('balance')); | ||||
| 		$this->assertSame("saldo", __x('money', 'balance')); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Test basic context support using mo files. | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	public function testContextMoFile() { | ||||
| 		Configure::write('Config.language', 'nld_mo'); | ||||
| 
 | ||||
| 		$this->assertSame("brief", __x('mail', 'letter')); | ||||
| 		$this->assertSame("letter", __x('character', 'letter')); | ||||
| 		$this->assertSame("bal", __x('spherical object', 'ball')); | ||||
| 		$this->assertSame("danspartij", __x('social gathering', 'ball')); | ||||
| 		$this->assertSame("balans", __('balance')); | ||||
| 		$this->assertSame("saldo", __x('money', 'balance')); | ||||
| 
 | ||||
| 		// MO file is sorted by msgid, 'zoo' should be last
 | ||||
| 		$this->assertSame("dierentuin", __('zoo')); | ||||
| 	} | ||||
| 
 | ||||
| /** | ||||
|  * Singular method | ||||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __domainCategorySingular($domain = 'test_plugin', $category = 3) { | ||||
| 	protected function _domainCategorySingular($domain = 'test_plugin', $category = 3) { | ||||
| 		$singular = __dc($domain, 'Plural Rule 1', $category); | ||||
| 		return $singular; | ||||
| 	} | ||||
|  | @ -1867,7 +2074,7 @@ class I18nTest extends CakeTestCase { | |||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __domainCategoryPlural($domain = 'test_plugin', $category = 3) { | ||||
| 	protected function _domainCategoryPlural($domain = 'test_plugin', $category = 3) { | ||||
| 		$plurals = array(); | ||||
| 		for ($number = 0; $number <= 25; $number++) { | ||||
| 			$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category), (float)$number); | ||||
|  | @ -1880,7 +2087,7 @@ class I18nTest extends CakeTestCase { | |||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __domainSingular($domain = 'test_plugin') { | ||||
| 	protected function _domainSingular($domain = 'test_plugin') { | ||||
| 		$singular = __d($domain, 'Plural Rule 1'); | ||||
| 		return $singular; | ||||
| 	} | ||||
|  | @ -1890,10 +2097,10 @@ class I18nTest extends CakeTestCase { | |||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __domainPlural($domain = 'test_plugin') { | ||||
| 	protected function _domainPlural($domain = 'test_plugin') { | ||||
| 		$plurals = array(); | ||||
| 		for ($number = 0; $number <= 25; $number++) { | ||||
| 			$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number ); | ||||
| 			$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); | ||||
| 		} | ||||
| 		return $plurals; | ||||
| 	} | ||||
|  | @ -1903,7 +2110,7 @@ class I18nTest extends CakeTestCase { | |||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __category($category = 3) { | ||||
| 	protected function _category($category = I18n::LC_MONETARY) { | ||||
| 		$singular = __c('Plural Rule 1', $category); | ||||
| 		return $singular; | ||||
| 	} | ||||
|  | @ -1913,7 +2120,7 @@ class I18nTest extends CakeTestCase { | |||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __singular() { | ||||
| 	protected function _singular() { | ||||
| 		$singular = __('Plural Rule 1'); | ||||
| 		return $singular; | ||||
| 	} | ||||
|  | @ -1921,11 +2128,12 @@ class I18nTest extends CakeTestCase { | |||
| /** | ||||
|  * Plural method | ||||
|  * | ||||
|  * @param int $upTo For numbers upto (default to 25) | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __plural() { | ||||
| 	protected function _plural($upTo = 25) { | ||||
| 		$plurals = array(); | ||||
| 		for ($number = 0; $number <= 25; $number++) { | ||||
| 		for ($number = 0; $number <= $upTo; $number++) { | ||||
| 			$plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); | ||||
| 		} | ||||
| 		return $plurals; | ||||
|  | @ -1936,7 +2144,7 @@ class I18nTest extends CakeTestCase { | |||
|  * | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __singularFromCore() { | ||||
| 	protected function _singularFromCore() { | ||||
| 		$singular = __('Plural Rule 1 (from core)'); | ||||
| 		return $singular; | ||||
| 	} | ||||
|  | @ -1944,12 +2152,13 @@ class I18nTest extends CakeTestCase { | |||
| /** | ||||
|  * pluralFromCore method | ||||
|  * | ||||
|  * @param int $upTo For numbers upto (default to 25) | ||||
|  * @return void | ||||
|  */ | ||||
| 	private function __pluralFromCore() { | ||||
| 	protected function _pluralFromCore($upTo = 25) { | ||||
| 		$plurals = array(); | ||||
| 		for ($number = 0; $number <= 25; $number++) { | ||||
| 			$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number ); | ||||
| 		for ($number = 0; $number <= $upTo; $number++) { | ||||
| 			$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number); | ||||
| 		} | ||||
| 		return $plurals; | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brm Ko
						Brm Ko