|
|
@ -14,16 +14,17 @@ require_once dirname(__FILE__) . '/../../Registry.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../Config.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../classes/Env.class.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../i18n/I18N.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../exception/GeneralException.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../exception/InitializationException.php'; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @runTestsInSeparateProcesses |
|
|
|
*/ |
|
|
|
class I18NTest extends PHPUnit_Framework_TestCase |
|
|
|
{ |
|
|
|
|
|
|
|
public function run(PHPUnit_Framework_TestResult $result = NULL) |
|
|
|
{ |
|
|
|
$this->setConstants(); |
|
|
|
$this->setPreserveGlobalState(false); |
|
|
|
return parent::run($result); |
|
|
|
} |
|
|
@ -34,18 +35,18 @@ class I18NTest extends PHPUnit_Framework_TestCase |
|
|
|
public function testInit() |
|
|
|
{ |
|
|
|
$this->setConstants(); |
|
|
|
Config::set('I18N', array('locales' => array('ru' => 'ru-ru', 'us' => 'en-us'))); |
|
|
|
|
|
|
|
Config::set('I18N', array('locales' => array('ru' => 'ru-ru', 'us' => 'en-us'))); |
|
|
|
I18N::init(); |
|
|
|
$this->assertAttributeEquals(array('ru' => 'ru-ru', 'us' => 'en-us'), 'locales', 'I18N'); |
|
|
|
$this->assertAttributeEquals('ru-ru', 'locale', 'I18N'); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @expectedException GeneralException |
|
|
|
*/ |
|
|
|
|
|
|
|
public function testInitNoConfig() |
|
|
|
{ |
|
|
|
Config::set('I18N', array('locales' => null)); |
|
|
|
$this->setExpectedException('InitializationException'); |
|
|
|
I18N::init(); |
|
|
|
} |
|
|
|
|
|
|
|