public function testPathWithStringI18N() { i18n::setCulture('fr'); i18n::addDefinitions(array('url.myapp' => 'monapp', 'url.mycontroller' => 'moncontroller', 'url.myaction' => 'monaction')); $this->assertEqual(UrlComponent::path('/myapp/mycontroller/myaction'), '/monapp/moncontroller/monaction'); $this->assertEqual(UrlComponent::path('mycontroller/myaction'), '/monapp/moncontroller/monaction'); $this->assertEqual(UrlComponent::path('/myapp/default/index'), '/monapp/default/index'); $this->assertEqual(UrlComponent::path('default/index'), '/monapp/default/index'); }
public function __construct() { $Dispatcher = Dispatcher::getInstance(); $Dispatcher->setApp('app'); $Dispatcher->setControllerName('myController'); $Dispatcher->setActionName('myAction'); i18n::setCulture('fr'); i18n::addDefinitions($this->def); }
<?php define('ROOT', realpath(dirname(__FILE__) . '/../../')); define('LIB', ROOT . '/_lib'); define('APP', ROOT . '/apps' . dirname($_SERVER['SCRIPT_NAME'])); define('MODELS', ROOT . '/models'); define('CONTROLLERS', APP . '/controllers'); define('VIEWS', APP . '/views'); require_once LIB . '/core/_includes.php'; require_once LIB . '/vendors/doctrine/Doctrine.php'; require_once ROOT . '/configs/env.php'; require_once ROOT . '/configs/lang.php'; require_once ROOT . '/configs/set.php'; i18n::setCulture(LANG); i18n::addDefinitionPath(APP . '/configs/i18n'); i18n::loadDefinitions(); $Bootstrap = Bootstrap::getInstance(); $Bootstrap->setDefaultPath('default/index'); $Bootstrap->setEnv(ENV); $Bootstrap->addAutoloadPath(CONTROLLERS); $Bootstrap->addAutoloadPath(CONTROLLERS . '/_components'); $Bootstrap->addAutoloadPath(VIEWS); $Bootstrap->addAutoloadPath(VIEWS . '/_helpers'); $Bootstrap->loadConfigs(ROOT . '/configs'); $Bootstrap->loadConfigs(APP . '/configs'); $Bootstrap->addModelPath(MODELS . '/bases'); $Bootstrap->addModelPath(MODELS); $Bootstrap->setDoctrine(); $Bootstrap->dispatch();