diff options
author | Anika Henke <anika@selfthinker.org> | 2013-07-21 18:52:40 +0100 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2013-07-21 18:52:40 +0100 |
commit | 8c7670b52dc523860f442a628ae7d226988e96d7 (patch) | |
tree | d99053d878efb0829f99a35bb77cb02c1ae3c524 /_test/tests/inc/common_basicinfo.test.php | |
parent | 20beef63b4694afdc3d6c434c3d27c982b6a986b (diff) | |
parent | fbd8067eeeb9f424981aad8b283e17f734c738c3 (diff) | |
download | rpg-8c7670b52dc523860f442a628ae7d226988e96d7.tar.gz rpg-8c7670b52dc523860f442a628ae7d226988e96d7.tar.bz2 |
Merge remote-tracking branch 'origin/master' into loggedin-class
Diffstat (limited to '_test/tests/inc/common_basicinfo.test.php')
-rw-r--r-- | _test/tests/inc/common_basicinfo.test.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/_test/tests/inc/common_basicinfo.test.php b/_test/tests/inc/common_basicinfo.test.php new file mode 100644 index 000000000..0369474c9 --- /dev/null +++ b/_test/tests/inc/common_basicinfo.test.php @@ -0,0 +1,64 @@ +<?php + +class common_infofunctions_test extends DokuWikiTest { + + function setup(){ + parent::setup(); + + global $USERINFO; + $USERINFO = array( + 'pass' => '179ad45c6ce2cb97cf1029e212046e81', + 'name' => 'Arthur Dent', + 'mail' => 'arthur@example.com', + 'grps' => array ('admin','user'), + ); + $_SERVER['REMOTE_USER'] = 'testuser'; + $_SERVER['REMOTE_ADDR'] = '1.2.3.4'; + } + + function _get_info() { + global $USERINFO; + $info = array (
+ 'isadmin' => true,
+ 'ismanager' => true, + 'userinfo' => $USERINFO,
+ 'perm' => 255,
+ 'namespace' => false,
+ 'ismobile' => false, + 'client' => 'testuser', + ); + + return $info; + } + + /** + * Its important to have the correct set of keys. + * Other functions provide the values + */ + function test_basicinfo(){ + // test with REMOTE_USER set and the user an admin user + $info = $this->_get_info(); + $this->assertEquals(basicinfo($ID,true),$info); + + // with $httpclient parameter set to false + unset($info['ismobile']); + $this->assertEquals(basicinfo($ID,false),$info); + + // with anonymous user + unset($_SERVER['REMOTE_USER']); + global $USERINFO; $USERINFO = array(); + + $info = array( + 'isadmin' => false, + 'ismanager' => false, + 'perm' => 8, + 'namespace' => false, + 'ismobile' => false, + 'client' => '1.2.3.4', + ); + $this->assertEquals(basicinfo($ID,true),$info); + } + +} + +//Setup VIM: ex: et ts=4 : |