bugfix: trustedproxy is not a delimited pcre
[dokuwiki.git] / _test / tests / inc / common_basicinfo.test.php
blobbdb77087e92ad9a351cca7c0a14a8a423621720c
1 <?php
3 class common_infofunctions_test extends DokuWikiTest {
5 function setup() : void {
6 parent::setup();
8 global $USERINFO;
9 $USERINFO = array(
10 'pass' => '179ad45c6ce2cb97cf1029e212046e81',
11 'name' => 'Arthur Dent',
12 'mail' => 'arthur@example.com',
13 'grps' => array ('admin','user'),
15 $_SERVER['REMOTE_USER'] = 'testuser';
16 $_SERVER['REMOTE_ADDR'] = '1.2.3.4';
19 function _get_info() {
20 global $USERINFO;
21 $info = array (
22 'isadmin' => true,
23 'ismanager' => true,
24 'userinfo' => $USERINFO,
25 'perm' => 255,
26 'namespace' => false,
27 'ismobile' => false,
28 'client' => 'testuser',
31 return $info;
34 /**
35 * Its important to have the correct set of keys.
36 * Other functions provide the values
38 function test_basicinfo(){
39 global $ID;
40 // test with REMOTE_USER set and the user an admin user
41 $info = $this->_get_info();
42 $this->assertEquals(basicinfo($ID,true),$info);
44 // with $httpclient parameter set to false
45 unset($info['ismobile']);
46 $this->assertEquals(basicinfo($ID,false),$info);
48 // with anonymous user
49 unset($_SERVER['REMOTE_USER']);
50 global $USERINFO; $USERINFO = array();
52 $info = array(
53 'isadmin' => false,
54 'ismanager' => false,
55 'perm' => 8,
56 'namespace' => false,
57 'ismobile' => false,
58 'client' => '1.2.3.4',
60 $this->assertEquals(basicinfo($ID,true),$info);
65 //Setup VIM: ex: et ts=4 :