diff options
author | Andreas Gohr <andi@splitbrain.org> | 2023-12-01 15:28:58 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2023-12-01 15:28:58 +0100 |
commit | c26881ef0abb1e98a0e6ad8710d331bc2815dfbb (patch) | |
tree | 05d4ae92bfc763a3ba7a94980813e7a7186fdbd5 | |
parent | 7af0b2864dad652705c2a12f2f7b817264680326 (diff) | |
download | dokuwiki-c26881ef0abb1e98a0e6ad8710d331bc2815dfbb.tar.gz dokuwiki-c26881ef0abb1e98a0e6ad8710d331bc2815dfbb.zip |
More adjusted API tests
-rw-r--r-- | _test/tests/Remote/ApiCoreAclCheckTest.php (renamed from _test/tests/inc/remoteapicore_aclcheck.test.php) | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/_test/tests/inc/remoteapicore_aclcheck.test.php b/_test/tests/Remote/ApiCoreAclCheckTest.php index 1e34b5427..39ac4b282 100644 --- a/_test/tests/inc/remoteapicore_aclcheck.test.php +++ b/_test/tests/Remote/ApiCoreAclCheckTest.php @@ -1,11 +1,13 @@ <?php +namespace dokuwiki\test\Remote; + use dokuwiki\Remote\Api; /** * Class remoteapicore_test */ -class remoteapicore_aclcheck_test extends DokuWikiTest { +class ApiCoreAclCheckTest extends \DokuWikiTest { protected $userinfo; protected $oldAuthAcl; @@ -18,7 +20,7 @@ class remoteapicore_aclcheck_test extends DokuWikiTest { global $auth; /* auth caches data loaded from file, but recreated object forces reload */ - $auth = new auth_plugin_authplain(); + $auth = new \auth_plugin_authplain(); } public function setUp() : void { @@ -58,7 +60,7 @@ class remoteapicore_aclcheck_test extends DokuWikiTest { copy($name . ".orig", $name); } - public function test_checkacl() { + public function testCheckacl() { global $conf; global $AUTH_ACL, $USERINFO; /** @var auth_plugin_authplain $auth */ @@ -66,71 +68,71 @@ class remoteapicore_aclcheck_test extends DokuWikiTest { $conf['useacl'] = 1; $_SERVER['REMOTE_USER'] = 'john'; - $USERINFO['grps'] = array('user'); - $AUTH_ACL = array( + $USERINFO['grps'] = ['user']; + $AUTH_ACL = [ '* @ALL 0', //none '* @user 2', //edit '* @more 4', //create 'nice_page user2 8' //upload - ); + ]; - $params = array('nice_page'); + $params = ['nice_page']; $this->assertEquals(AUTH_EDIT, $this->remote->call('wiki.aclCheck', $params)); $auth->createUser("user1", "54321", "a User", "you@example.com"); $auth->createUser("user2", "543210", "You", "he@example.com"); - $auth->createUser("mwuser", "12345", "Wiki User", "me@example.com", array('more')); //not in default group + $auth->createUser("mwuser", "12345", "Wiki User", "me@example.com", ['more']); //not in default group - $params = array( + $params = [ 'nice_page', 'user1' - ); + ]; $this->assertEquals(AUTH_EDIT, $this->remote->call('wiki.aclCheck', $params)); - $params = array( + $params = [ 'nice_page', 'mwuser' // member of group 'more' - ); + ]; $this->assertEquals(AUTH_CREATE, $this->remote->call('wiki.aclCheck', $params)); - $params = array( + $params = [ 'nice_page', 'mwuser', - array() //groups not retrieved - ); + [] //groups not retrieved + ]; $this->assertEquals(AUTH_NONE, $this->remote->call('wiki.aclCheck', $params)); - $params = array( + $params = [ 'nice_page', 'notexistinguser', - array('more') - ); + ['more'] + ]; $this->assertEquals(AUTH_CREATE, $this->remote->call('wiki.aclCheck', $params)); - $params = array( + $params = [ 'nice_page', 'user2' - ); + ]; $this->assertEquals(AUTH_UPLOAD, $this->remote->call('wiki.aclCheck', $params)); - $params = array( + $params = [ 'nice_page', 'user2', - array() //groups not retrieved - ); + [] //groups not retrieved + ]; $this->assertEquals(AUTH_UPLOAD, $this->remote->call('wiki.aclCheck', $params)); - $params = array( + $params = [ 'unknown_page', 'user2' - ); + ]; $this->assertEquals(AUTH_EDIT, $this->remote->call('wiki.aclCheck', $params)); - $params = array( + $params = [ 'unknown_page', 'user2', - array() //groups not retrieved - ); + [] //groups not retrieved + ]; $this->assertEquals(AUTH_NONE, $this->remote->call('wiki.aclCheck', $params)); $params = array( |