summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorDominik Eckelmann <deckelmann@gmail.com>2012-01-08 14:54:53 +0100
committerDominik Eckelmann <deckelmann@gmail.com>2012-01-08 14:54:53 +0100
commita317247b19c498f4292480110cf0e0a1ce9780e8 (patch)
treeb428679bf3a62da9d19355bd6df097df54796667 /_test
parenteb20307ad68614b8834c804eeade389967db5ed4 (diff)
downloadrpg-a317247b19c498f4292480110cf0e0a1ce9780e8.tar.gz
rpg-a317247b19c498f4292480110cf0e0a1ce9780e8.tar.bz2
updated remote hasAccess function
Diffstat (limited to '_test')
-rw-r--r--_test/cases/inc/remote.test.php46
1 files changed, 44 insertions, 2 deletions
diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php
index 23186344b..b6a683f45 100644
--- a/_test/cases/inc/remote.test.php
+++ b/_test/cases/inc/remote.test.php
@@ -99,12 +99,15 @@ class remote_plugin_testplugin extends DokuWiki_Remote_Plugin {
class remote_test extends UnitTestCase {
var $originalConf;
+ var $userinfo;
var $remote;
function setUp() {
global $plugin_controller;
global $conf;
+ global $USERINFO;
+
parent::setUp();
$pluginManager = new MockDoku_Plugin_Controller();
$pluginManager->setReturnValue('getList', array('testplugin'));
@@ -112,13 +115,19 @@ class remote_test extends UnitTestCase {
$plugin_controller = $pluginManager;
$this->originalConf = $conf;
+ $conf['remote'] = 1;
+ $conf['useacl'] = 0;
+ $this->userinfo = $USERINFO;
$this->remote = new RemoteAPI();
}
function tearDown() {
global $conf;
+ global $USERINFO;
$conf = $this->originalConf;
+ $USERINFO = $this->userinfo;
+
}
function test_pluginMethods() {
@@ -131,8 +140,6 @@ class remote_test extends UnitTestCase {
}
function test_hasAccessSuccess() {
- global $conf;
- $conf['remote'] = 1;
$this->assertTrue($this->remote->hasAccess());
}
@@ -142,6 +149,41 @@ class remote_test extends UnitTestCase {
$this->assertFalse($this->remote->hasAccess());
}
+ function test_hasAccessFailAcl() {
+ global $conf;
+ $conf['useacl'] = 1;
+ $this->assertFalse($this->remote->hasAccess());
+ }
+
+ function test_hasAccessSuccessAclEmptyRemoteUser() {
+ global $conf;
+ $conf['useacl'] = 1;
+ $conf['remoteuser'] = '';
+
+ $this->assertTrue($this->remote->hasAccess());
+ }
+
+ function test_hasAccessSuccessAcl() {
+ global $conf;
+ global $USERINFO;
+ $conf['useacl'] = 1;
+ $conf['remoteuser'] = '@grp,@grp2';
+ $USERINFO['grps'] = array('grp');
+
+ $this->assertTrue($this->remote->hasAccess());
+ }
+
+ function test_hasAccessFailAcl2() {
+ global $conf;
+ global $USERINFO;
+ $conf['useacl'] = 1;
+ $conf['remoteuser'] = '@grp';
+ $USERINFO['grps'] = array('grp1');
+
+ $this->assertFalse($this->remote->hasAccess());
+ }
+
+
function test_forceAccessSuccess() {
global $conf;
$conf['remote'] = 1;