diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-10-19 01:45:02 -0700 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-10-19 01:45:02 -0700 |
commit | 14dd1564b8f04e9c4b658365f70f86133e38e6ad (patch) | |
tree | a4e62dc46bf248740795ab3768a07b1b2c36d39b | |
parent | 8a2fc4c5bacdffd2681947fb2bce728dc50ac453 (diff) | |
parent | 4e2ac2e47ffdfffadfa5674d55f6f96c5e1cae77 (diff) | |
download | rpg-14dd1564b8f04e9c4b658365f70f86133e38e6ad.tar.gz rpg-14dd1564b8f04e9c4b658365f70f86133e38e6ad.tar.bz2 |
Merge pull request #384 from splitbrain/lang_in_tests
Fix missing values in unittest harness
-rw-r--r-- | _test/bootstrap.php | 7 | ||||
-rw-r--r-- | inc/init.php | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/_test/bootstrap.php b/_test/bootstrap.php index 732fef9ed..3f59db515 100644 --- a/_test/bootstrap.php +++ b/_test/bootstrap.php @@ -68,6 +68,13 @@ $default_server_vars = array( 'REQUEST_TIME' => time(), ); +// fixup for $_SERVER when run from CLI, +// some values should be mocked for use by inc/init.php which is called here +// [ $_SERVER is also mocked in TestRequest::execute() ] +if (php_sapi_name() == 'cli') { + $_SERVER = array_merge($default_server_vars, $_SERVER); +} + // create temp directories mkdir(TMP_DIR); diff --git a/inc/init.php b/inc/init.php index 30eb1b251..248d27b9c 100644 --- a/inc/init.php +++ b/inc/init.php @@ -267,10 +267,10 @@ function init_lang($langCode) { $lang = array(); //load the language files - require_once(DOKU_INC.'inc/lang/en/lang.php'); + require(DOKU_INC.'inc/lang/en/lang.php'); if ($langCode && $langCode != 'en') { if (file_exists(DOKU_INC."inc/lang/$langCode/lang.php")) { - require_once(DOKU_INC."inc/lang/$langCode/lang.php"); + require(DOKU_INC."inc/lang/$langCode/lang.php"); } } } |