public function setUp() { Config::addConfigFromPath(__DIR__ . '/testConfig.php'); $this->model = new Lang($this->settings); $this->testClassName = get_class($this->model); $this->reflection = new ReflectionClass($this->testClassName); }
protected function addTestConfigToModel() { Config::addConfigFromPath(__DIR__ . '/testConfig.php'); }
/** * @covers Trans::loadTranslations */ public function testLoadTranslationsOtherLn() { $expected = ['global' => 'weltweit', 'comma' => 'Komma', 'no' => 'nein', 'yes' => 'ja']; Config::addConfigFromPath(__DIR__ . '/testConfig.php'); Config::setLn('de'); $model = new Trans('testTrans'); $model->loadTranslations(); $result = $model->getAllTranslations(); $this->assertEquals($expected, $result); }
error_reporting(E_ALL | E_STRICT); ini_set("display_errors", 1); // force 'no www' if (substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.') { header('HTTP/1.1 301 Moved Permanently'); header('Location: https://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI']); exit; } require '../app/bootstrap.php'; use Model\Config; use Model\StuartMcLeanWebsite; use Model\Lang; use Model\AppException; use Model\Monologger; Config::addConfigFromPath(__DIR__ . '/../app/Config/config_default.php'); Config::addConfigFromPath(__DIR__ . '/../app/Config/config_local.php'); $logger = new Monologger('exception_log'); try { $app = new StuartMcLeanWebsite(Config::getParam(Config::SLIM)); $app->addLogger($logger); $lang = new Lang(Config::getParam(Config::LN)); $lang->detectLang($app); } catch (AppException $e) { $logger->addError($e); if (Config::getParam(Config::SLIM)['debug']) { die($e); } } // todo:: redirect to same url in different language if (!$lang->isInUrl()) { $app->redirect('/' . $lang->getDefault() . $app->getUri(), 301);