diff options
author | tof <> | 2007-06-13 13:26:47 +0000 |
---|---|---|
committer | tof <> | 2007-06-13 13:26:47 +0000 |
commit | 3c9273ac549886ee337e08d8781fdfd55b05f573 (patch) | |
tree | 19b8aacb9456621719a8937bc0750fe67ebbcaae /tests/unit/Prado.php | |
parent | c4bfd9c55f00407bfdb9eec59dcf71a9016cd704 (diff) |
Override PradoBase::getUserLanguages() so the $languages var is recomputed on each call from test suite.
Diffstat (limited to 'tests/unit/Prado.php')
-rw-r--r-- | tests/unit/Prado.php | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/unit/Prado.php b/tests/unit/Prado.php index aebcfcd0..9e73c934 100644 --- a/tests/unit/Prado.php +++ b/tests/unit/Prado.php @@ -117,7 +117,34 @@ class Prado extends PradoBase { } else { throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path); } - }*/ + }*/ + + + public static function getUserLanguages() + { + $languages=null; + // Recompute $languages each times it's called for unit tests + /*if($languages===null) + {*/ + if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) + $languages[0]='en'; + else + { + $languages=array(); + foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language) + { + $array=split(';q=',trim($language)); + $languages[trim($array[0])]=isset($array[1])?(float)$array[1]:1.0; + } + arsort($languages); + $languages=array_keys($languages); + if(empty($languages)) + $languages[0]='en'; + } + /*}*/ + return $languages; + } + } ?>
\ No newline at end of file |