summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
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;