1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- require_once('gettext.inc');
- class LocaleTest extends PHPUnit_Framework_TestCase
- {
- public function test_setlocale()
- {
- putenv("LC_ALL=");
-
- putenv("LANG=sr_RS");
- $this->assertEquals('sr_RS', _setlocale(LC_MESSAGES, 0));
- }
- public function test_setlocale_system()
- {
- putenv("LC_ALL=");
-
- putenv("LANG=C");
- _setlocale(LC_MESSAGES, "");
- $this->assertEquals(0, locale_emulation());
- }
- public function test_setlocale_emulation()
- {
- putenv("LC_ALL=");
-
-
- _setlocale(LC_MESSAGES, "xxx_XXX");
- $this->assertEquals('xxx_XXX', _setlocale(LC_MESSAGES, 0));
- $this->assertEquals(1, locale_emulation());
- }
- public function test_get_list_of_locales()
- {
-
-
-
- $this->assertEquals(
- array("sr_RS", "sr"),
- get_list_of_locales("sr_RS")
- );
-
- $this->assertEquals(
- array("sr"),
- get_list_of_locales("sr")
- );
-
- $this->assertEquals(
- array("sr.UTF-8", "sr"),
- get_list_of_locales("sr.UTF-8")
- );
-
- $this->assertEquals(
- array("sr_RS.UTF-8", "sr_RS", "sr"),
- get_list_of_locales("sr_RS.UTF-8")
- );
-
- $this->assertEquals(
- array("sr_RS.UTF-8@latin", "sr_RS@latin", "sr@latin",
- "sr_RS.UTF-8", "sr_RS", "sr"),
- get_list_of_locales("sr_RS.UTF-8@latin")
- );
-
- $this->assertEquals(
- array("sr@latin", "sr"),
- get_list_of_locales("sr@latin")
- );
-
-
- $this->assertEquals(
- array("something"),
- get_list_of_locales("something")
- );
-
- $this->assertEquals(
- array(),
- get_list_of_locales("")
- );
- }
- }
|