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