/usr/share/php/kohana3.1/system/tests/kohana/I18nTest.php is in libkohana3.1-core-php 3.1.5-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | <?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run');
/**
* Tests Kohana i18n class
*
* @group kohana
* @group kohana.core
* @group kohana.core.i18n
*
* @package Kohana
* @category Tests
* @author Kohana Team
* @author Jeremy Bush <contractfrombelow@gmail.com>
* @copyright (c) 2008-2012 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_I18nTest extends Unittest_TestCase {
/**
* Default values for the environment, see setEnvironment
* @var array
*/
protected $environmentDefault = array(
'I18n::$lang' => 'en-us',
);
/**
* Provides test data for test_lang()
*
* @return array
*/
public function provider_lang()
{
return array(
// $input, $expected_result
array(NULL, 'en-us'),
array('es-es', 'es-es'),
);
}
/**
* Tests I18n::lang()
*
* @test
* @dataProvider provider_lang
* @param boolean $input Input for I18n::lang
* @param boolean $expected Output for I18n::lang
*/
public function test_lang($input, $expected_result)
{
$this->assertSame($expected_result, I18n::lang($input));
$this->assertSame($expected_result, I18n::lang());
}
/**
* Provides test data for test_get()
*
* @return array
*/
public function provider_get()
{
return array(
// $value, $result
array('en-us', 'Hello, world!', 'Hello, world!'),
array('es-es', 'Hello, world!', '¡Hola, mundo!'),
array('fr-fr', 'Hello, world!', 'Bonjour, monde!'),
);
}
/**
* Tests i18n::get()
*
* @test
* @dataProvider provider_get
* @param boolean $input Input for File::mime
* @param boolean $expected Output for File::mime
*/
public function test_get($lang, $input, $expected)
{
I18n::lang($lang);
$this->assertSame($expected, I18n::get($input));
// Test immediate translation, issue #3085
I18n::lang('en-us');
$this->assertSame($expected, I18n::get($input, $lang));
}
}
|