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 | |
parent | c4bfd9c55f00407bfdb9eec59dcf71a9016cd704 (diff) |
Override PradoBase::getUserLanguages() so the $languages var is recomputed on each call from test suite.
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/Prado.php | 29 | ||||
-rw-r--r-- | tests/unit/Web/AllTests.php | 2 |
2 files changed, 29 insertions, 2 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 diff --git a/tests/unit/Web/AllTests.php b/tests/unit/Web/AllTests.php index b40b212f..0315c7eb 100644 --- a/tests/unit/Web/AllTests.php +++ b/tests/unit/Web/AllTests.php @@ -24,10 +24,10 @@ class Web_AllTests { public static function suite() { $suite = new PHPUnit_Framework_TestSuite('System.Web'); - $suite->addTestSuite('THttpRequestTest'); $suite->addTestSuite('TAssetManagerTest'); $suite->addTestSuite('THttpCookieCollectionTest'); $suite->addTestSuite('THttpCookieTest'); + $suite->addTestSuite('THttpRequestTest'); $suite->addTestSuite('THttpResponseTest'); $suite->addTestSuite('THttpSessionTest'); $suite->addTestSuite('THttpUtilityTest'); |