diff options
-rw-r--r-- | _test/mock/AuthCaseInsensitivePlugin.php | 12 | ||||
-rw-r--r-- | _test/mock/AuthDeletePlugin.php | 28 | ||||
-rw-r--r-- | _test/tests/inc/auth_aclcheck_caseinsensitive.test.php | 10 | ||||
-rw-r--r-- | _test/tests/inc/auth_admincheck.test.php | 9 | ||||
-rw-r--r-- | _test/tests/inc/auth_deleteprofile.test.php | 34 | ||||
-rw-r--r-- | _test/tests/inc/remote.test.php | 8 | ||||
-rw-r--r-- | _test/tests/inc/remoteapicore.test.php | 3 |
7 files changed, 54 insertions, 50 deletions
diff --git a/_test/mock/AuthCaseInsensitivePlugin.php b/_test/mock/AuthCaseInsensitivePlugin.php new file mode 100644 index 000000000..cf71c0c8c --- /dev/null +++ b/_test/mock/AuthCaseInsensitivePlugin.php @@ -0,0 +1,12 @@ +<?php + +namespace dokuwiki\test\mock; + +/** + * Class dokuwiki\Plugin\DokuWiki_Auth_Plugin + */ +class AuthCaseInsensitivePlugin extends AuthPlugin { + function isCaseSensitive(){ + return false; + } +}
\ No newline at end of file diff --git a/_test/mock/AuthDeletePlugin.php b/_test/mock/AuthDeletePlugin.php new file mode 100644 index 000000000..82e96f2a6 --- /dev/null +++ b/_test/mock/AuthDeletePlugin.php @@ -0,0 +1,28 @@ +<?php + +namespace dokuwiki\test\mock; + +/** + * Class dokuwiki\Plugin\DokuWiki_Auth_Plugin + */ +class AuthDeletePlugin extends AuthPlugin { + + public $loggedOff = false; + + public function __construct($canDeleteUser = true) { + $this->cando['delUser'] = $canDeleteUser; + } + + public function checkPass($user, $pass) { + return $pass == 'password'; + } + + public function deleteUsers($users) { + return in_array($_SERVER['REMOTE_USER'], $users); + } + + public function logoff() { + $this->loggedOff = true; + } + +}
\ No newline at end of file diff --git a/_test/tests/inc/auth_aclcheck_caseinsensitive.test.php b/_test/tests/inc/auth_aclcheck_caseinsensitive.test.php index 644675de4..af0f17223 100644 --- a/_test/tests/inc/auth_aclcheck_caseinsensitive.test.php +++ b/_test/tests/inc/auth_aclcheck_caseinsensitive.test.php @@ -1,12 +1,6 @@ <?php -use dokuwiki\Extension\AuthPlugin; - -class auth_acl_caseinsensitive_auth extends AuthPlugin { - function isCaseSensitive() { - return false; - } -} +use dokuwiki\test\mock\AuthCaseInsensitivePlugin; class auth_acl_caseinsensitive_test extends DokuWikiTest { protected $oldAuth; @@ -20,7 +14,7 @@ class auth_acl_caseinsensitive_test extends DokuWikiTest { $this->oldAuth = $auth; $this->oldAuthAcl = $AUTH_ACL; - $auth = new auth_acl_caseinsensitive_auth(); + $auth = new AuthCaseInsensitivePlugin(); } function tearDown() { diff --git a/_test/tests/inc/auth_admincheck.test.php b/_test/tests/inc/auth_admincheck.test.php index 82ddafcff..23e9b0035 100644 --- a/_test/tests/inc/auth_admincheck.test.php +++ b/_test/tests/inc/auth_admincheck.test.php @@ -1,12 +1,7 @@ <?php use dokuwiki\test\mock\AuthPlugin; - -class auth_admin_test_AuthInSensitive extends AuthPlugin { - function isCaseSensitive(){ - return false; - } -} +use dokuwiki\test\mock\AuthCaseInsensitivePlugin; class auth_admin_test extends DokuWikiTest { @@ -25,7 +20,7 @@ class auth_admin_test extends DokuWikiTest { function setInSensitive() { global $auth; - $auth = new auth_admin_test_AuthInSensitive(); + $auth = new AuthCaseInsensitivePlugin(); } function teardown() { diff --git a/_test/tests/inc/auth_deleteprofile.test.php b/_test/tests/inc/auth_deleteprofile.test.php index 156920771..ebefae59d 100644 --- a/_test/tests/inc/auth_deleteprofile.test.php +++ b/_test/tests/inc/auth_deleteprofile.test.php @@ -1,29 +1,7 @@ <?php use dokuwiki\Input\Input; -use dokuwiki\Extension\AuthPlugin; - -class auth_deleteprofile_test_AuthDelete extends AuthPlugin { - - public $loggedOff = false; - - public function __construct($canDeleteUser = true) { - $this->cando['delUser'] = $canDeleteUser; - } - - public function checkPass($user, $pass) { - return $pass == 'password'; - } - - public function deleteUsers($users) { - return in_array($_SERVER['REMOTE_USER'], $users); - } - - public function logoff() { - $this->loggedOff = true; - } - -} +use dokuwiki\test\mock\AuthDeletePlugin; class auth_deleteprofile_test extends DokuWikiTest { @@ -56,7 +34,7 @@ class auth_deleteprofile_test extends DokuWikiTest { $_REQUEST = $input; $INPUT = new Input(); - $auth = new auth_deleteprofile_test_AuthDelete(); + $auth = new AuthDeletePlugin(); $this->assertTrue(auth_deleteprofile()); $this->assertTrue($auth->loggedOff); @@ -82,7 +60,7 @@ class auth_deleteprofile_test extends DokuWikiTest { $_REQUEST = $input; $INPUT = new Input(); - $auth = new auth_deleteprofile_test_AuthDelete(); + $auth = new AuthDeletePlugin(); // password check required - it fails, so don't delete profile $this->assertFalse(auth_deleteprofile()); @@ -112,7 +90,7 @@ class auth_deleteprofile_test extends DokuWikiTest { $_REQUEST = $input; $INPUT = new Input(); - $auth = new auth_deleteprofile_test_AuthDelete(false); + $auth = new AuthDeletePlugin(false); $conf['disableactions'] = ''; $this->assertFalse(auth_deleteprofile()); } @@ -136,7 +114,7 @@ class auth_deleteprofile_test extends DokuWikiTest { $_REQUEST = $input; $INPUT = new Input(); - $auth = new auth_deleteprofile_test_AuthDelete(); + $auth = new AuthDeletePlugin(); $conf['disableactions'] = 'profile_delete'; $this->assertFalse(actionOK('profile_delete')); @@ -165,7 +143,7 @@ class auth_deleteprofile_test extends DokuWikiTest { $_REQUEST = $input; $input_foundation = new Input(); - $auth = new auth_deleteprofile_test_AuthDelete(); + $auth = new AuthDeletePlugin(); $INPUT = clone $input_foundation; $INPUT->remove('delete'); diff --git a/_test/tests/inc/remote.test.php b/_test/tests/inc/remote.test.php index 57bec8762..7f1ec4aff 100644 --- a/_test/tests/inc/remote.test.php +++ b/_test/tests/inc/remote.test.php @@ -1,14 +1,10 @@ <?php -use dokuwiki\Extension\AuthPlugin; +use dokuwiki\test\mock\AuthPlugin; use dokuwiki\Extension\RemotePlugin; use dokuwiki\Remote\Api; use dokuwiki\Remote\RemoteException; -class remote_test_MockAuthCase extends AuthPlugin { - function isCaseSensitive() { return true; } -} - class RemoteAPICoreTest { function __getRemoteInfo() { @@ -169,7 +165,7 @@ class remote_test extends DokuWikiTest { $this->userinfo = $USERINFO; $this->remote = new Api(); - $auth = new remote_test_MockAuthCase(); + $auth = new AuthPlugin(); } function tearDown() { diff --git a/_test/tests/inc/remoteapicore.test.php b/_test/tests/inc/remoteapicore.test.php index 606dc747c..e152d4ac5 100644 --- a/_test/tests/inc/remoteapicore.test.php +++ b/_test/tests/inc/remoteapicore.test.php @@ -3,6 +3,7 @@ use dokuwiki\Remote\Api; use dokuwiki\Remote\ApiCore; use dokuwiki\test\mock\AuthPlugin; +use dokuwiki\test\mock\AuthDeletePlugin; /** * Class remoteapicore_test @@ -452,7 +453,7 @@ You can use up to five different levels of', public function test_deleteUser() { global $conf, $auth; - $auth = new auth_deleteprofile_test_AuthDelete(); + $auth = new AuthDeletePlugin(); $conf['remote'] = 1; $conf['remoteuser'] = 'testuser'; $_SERVER['REMOTE_USER'] = 'testuser'; |