aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php122
1 files changed, 53 insertions, 69 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php
index 2de0ba6a8..a1e9ee36c 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAVACL;
use Sabre\DAV;
@@ -8,10 +10,10 @@ use Sabre\HTTP;
require_once 'Sabre/DAVACL/MockPrincipal.php';
require_once 'Sabre/DAVACL/MockACLNode.php';
-class SimplePluginTest extends \PHPUnit_Framework_TestCase {
-
- function testValues() {
-
+class SimplePluginTest extends \PHPUnit\Framework\TestCase
+{
+ public function testValues()
+ {
$aclPlugin = new Plugin();
$this->assertEquals('acl', $aclPlugin->getPluginName());
$this->assertEquals(
@@ -24,25 +26,24 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
'{DAV:}expand-property',
'{DAV:}principal-match',
'{DAV:}principal-property-search',
- '{DAV:}principal-search-property-set'
+ '{DAV:}principal-search-property-set',
],
$aclPlugin->getSupportedReportSet(''));
$this->assertEquals(['ACL'], $aclPlugin->getMethods(''));
-
$this->assertEquals(
'acl',
$aclPlugin->getPluginInfo()['name']
);
}
- function testGetFlatPrivilegeSet() {
-
+ public function testGetFlatPrivilegeSet()
+ {
$expected = [
'{DAV:}all' => [
- 'privilege' => '{DAV:}all',
- 'abstract' => false,
+ 'privilege' => '{DAV:}all',
+ 'abstract' => false,
'aggregates' => [
'{DAV:}read',
'{DAV:}write',
@@ -50,8 +51,8 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
'concrete' => '{DAV:}all',
],
'{DAV:}read' => [
- 'privilege' => '{DAV:}read',
- 'abstract' => false,
+ 'privilege' => '{DAV:}read',
+ 'abstract' => false,
'aggregates' => [
'{DAV:}read-acl',
'{DAV:}read-current-user-privilege-set',
@@ -59,20 +60,20 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
'concrete' => '{DAV:}read',
],
'{DAV:}read-acl' => [
- 'privilege' => '{DAV:}read-acl',
- 'abstract' => false,
+ 'privilege' => '{DAV:}read-acl',
+ 'abstract' => false,
'aggregates' => [],
- 'concrete' => '{DAV:}read-acl',
+ 'concrete' => '{DAV:}read-acl',
],
'{DAV:}read-current-user-privilege-set' => [
- 'privilege' => '{DAV:}read-current-user-privilege-set',
- 'abstract' => false,
+ 'privilege' => '{DAV:}read-current-user-privilege-set',
+ 'abstract' => false,
'aggregates' => [],
- 'concrete' => '{DAV:}read-current-user-privilege-set',
+ 'concrete' => '{DAV:}read-current-user-privilege-set',
],
'{DAV:}write' => [
- 'privilege' => '{DAV:}write',
- 'abstract' => false,
+ 'privilege' => '{DAV:}write',
+ 'abstract' => false,
'aggregates' => [
'{DAV:}write-properties',
'{DAV:}write-content',
@@ -83,36 +84,35 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
'concrete' => '{DAV:}write',
],
'{DAV:}write-properties' => [
- 'privilege' => '{DAV:}write-properties',
- 'abstract' => false,
+ 'privilege' => '{DAV:}write-properties',
+ 'abstract' => false,
'aggregates' => [],
- 'concrete' => '{DAV:}write-properties',
+ 'concrete' => '{DAV:}write-properties',
],
'{DAV:}write-content' => [
- 'privilege' => '{DAV:}write-content',
- 'abstract' => false,
+ 'privilege' => '{DAV:}write-content',
+ 'abstract' => false,
'aggregates' => [],
- 'concrete' => '{DAV:}write-content',
+ 'concrete' => '{DAV:}write-content',
],
'{DAV:}unlock' => [
- 'privilege' => '{DAV:}unlock',
- 'abstract' => false,
+ 'privilege' => '{DAV:}unlock',
+ 'abstract' => false,
'aggregates' => [],
- 'concrete' => '{DAV:}unlock',
+ 'concrete' => '{DAV:}unlock',
],
'{DAV:}bind' => [
- 'privilege' => '{DAV:}bind',
- 'abstract' => false,
+ 'privilege' => '{DAV:}bind',
+ 'abstract' => false,
'aggregates' => [],
- 'concrete' => '{DAV:}bind',
+ 'concrete' => '{DAV:}bind',
],
'{DAV:}unbind' => [
- 'privilege' => '{DAV:}unbind',
- 'abstract' => false,
+ 'privilege' => '{DAV:}unbind',
+ 'abstract' => false,
'aggregates' => [],
- 'concrete' => '{DAV:}unbind',
+ 'concrete' => '{DAV:}unbind',
],
-
];
$plugin = new Plugin();
@@ -120,28 +120,24 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$server = new DAV\Server();
$server->addPlugin($plugin);
$this->assertEquals($expected, $plugin->getFlatPrivilegeSet(''));
-
}
- function testCurrentUserPrincipalsNotLoggedIn() {
-
+ public function testCurrentUserPrincipalsNotLoggedIn()
+ {
$acl = new Plugin();
$acl->allowUnauthenticatedAccess = false;
$server = new DAV\Server();
$server->addPlugin($acl);
$this->assertEquals([], $acl->getCurrentUserPrincipals());
-
}
- function testCurrentUserPrincipalsSimple() {
-
+ public function testCurrentUserPrincipalsSimple()
+ {
$tree = [
-
new DAV\SimpleCollection('principals', [
new MockPrincipal('admin', 'principals/admin'),
- ])
-
+ ]),
];
$acl = new Plugin();
@@ -153,23 +149,20 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$server->addPlugin($auth);
//forcing login
- $auth->beforeMethod(new HTTP\Request(), new HTTP\Response());
+ $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response());
$this->assertEquals(['principals/admin'], $acl->getCurrentUserPrincipals());
-
}
- function testCurrentUserPrincipalsGroups() {
-
+ public function testCurrentUserPrincipalsGroups()
+ {
$tree = [
-
new DAV\SimpleCollection('principals', [
new MockPrincipal('admin', 'principals/admin', ['principals/administrators', 'principals/everyone']),
new MockPrincipal('administrators', 'principals/administrators', ['principals/groups'], ['principals/admin']),
new MockPrincipal('everyone', 'principals/everyone', [], ['principals/admin']),
new MockPrincipal('groups', 'principals/groups', [], ['principals/administrators']),
- ])
-
+ ]),
];
$acl = new Plugin();
@@ -181,7 +174,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$server->addPlugin($auth);
//forcing login
- $auth->beforeMethod(new HTTP\Request(), new HTTP\Response());
+ $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response());
$expected = [
'principals/admin',
@@ -194,11 +187,10 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
// The second one should trigger the cache and be identical
$this->assertEquals($expected, $acl->getCurrentUserPrincipals());
-
}
- function testGetACL() {
-
+ public function testGetACL()
+ {
$acl = [
[
'principal' => 'principals/admin',
@@ -210,7 +202,6 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
],
];
-
$tree = [
new MockACLNode('foo', $acl),
];
@@ -221,11 +212,10 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$server->addPlugin($aclPlugin);
$this->assertEquals($acl, $aclPlugin->getACL('foo'));
-
}
- function testGetCurrentUserPrivilegeSet() {
-
+ public function testGetCurrentUserPrivilegeSet()
+ {
$acl = [
[
'principal' => 'principals/admin',
@@ -241,14 +231,12 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
],
];
-
$tree = [
new MockACLNode('foo', $acl),
new DAV\SimpleCollection('principals', [
new MockPrincipal('admin', 'principals/admin'),
]),
-
];
$server = new DAV\Server($tree);
@@ -260,7 +248,7 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
$server->addPlugin($auth);
//forcing login
- $auth->beforeMethod(new HTTP\Request(), new HTTP\Response());
+ $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response());
$expected = [
'{DAV:}write',
@@ -274,11 +262,10 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
];
$this->assertEquals($expected, $aclPlugin->getCurrentUserPrivilegeSet('foo'));
-
}
- function testCheckPrivileges() {
-
+ public function testCheckPrivileges()
+ {
$acl = [
[
'principal' => 'principals/admin',
@@ -294,14 +281,12 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
],
];
-
$tree = [
new MockACLNode('foo', $acl),
new DAV\SimpleCollection('principals', [
new MockPrincipal('admin', 'principals/admin'),
]),
-
];
$server = new DAV\Server($tree);
@@ -316,6 +301,5 @@ class SimplePluginTest extends \PHPUnit_Framework_TestCase {
//$auth->beforeMethod('GET','/');
$this->assertFalse($aclPlugin->checkPrivileges('foo', ['{DAV:}read'], Plugin::R_PARENT, false));
-
}
}