summaryrefslogtreecommitdiff
path: root/_test/tests/inc/common_basicinfo.test.php
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2013-07-30 10:50:52 +0200
committerChristopher Smith <chris@jalakai.co.uk>2013-07-30 10:50:52 +0200
commitaf07997c5ff7cc096965159d90158e3710d2d019 (patch)
treedefaf770e77a679436eb56291185905b547640d0 /_test/tests/inc/common_basicinfo.test.php
parentbdac741579f8c6f00248d5d3ec635d4c2e08fb1e (diff)
parent7d8a6abbb21979fd77dca10275ebb8e01a04b6e4 (diff)
downloadrpg-af07997c5ff7cc096965159d90158e3710d2d019.tar.gz
rpg-af07997c5ff7cc096965159d90158e3710d2d019.tar.bz2
Merge branch 'master' into configmgr_improvements
Conflicts: inc/auth.php inc/template.php lib/plugins/authad/lang/zh/settings.php lib/plugins/authldap/lang/en/settings.php lib/plugins/authldap/lang/zh/settings.php lib/plugins/authmysql/lang/zh/settings.php lib/plugins/config/settings/config.class.php lib/plugins/usermanager/admin.php
Diffstat (limited to '_test/tests/inc/common_basicinfo.test.php')
-rw-r--r--_test/tests/inc/common_basicinfo.test.php64
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 :